Mr Rao,
"select max(primarykey)" is always highly optimized and fast.
Adordd its working like that but I found at least with Mysql that its taking too long.
If you try to use it for instances like a reccount() the browses begin to be very slow on a WAN even with tables of 50.000 recs.
I agree that its a must to have a primaryey as unique autoinc value.
COUNT() its not reliable and we should forget it. ADORRD recno its based on a primarykey and it can happen that count returns 20 rows but select max() returns 35. So adordd can only use select max otherwise we could have Lastrec() returning 20 and recno 35!
Next question is how frequently we need to keep checking for other users' inserts. We can't keep checking continuously.
If the reocrdset is ordered on the primary key, it may be enough to check when (i) DBGOBOTTOM() and (ii) when DBSKIP( +n ) hits EOF.
I was thinking in checking it before any update, addnew, delete. But dbgobott its good idea as a refresh trigger although it might not be ordered by the primarykey.
To test it on every skip is unfeasible with select max() it simply takes too long.
Another option Im study is to have a TRIGGER for every table primarykey field used as recno.
Something like this:
CREATE TRIGGER cname ON cTable BEFORE INSERT ...
Where it saves in a table like:
TLASTREC
TABLENAME C 30
MAXKEY N 10 0
The MAX value of the primarykey.
This table will be the size of n tables in the database so pretty small always.
Querying it even with skip should be lightning fast.
Concerning MSSQL QUEUES I didnt never tried it but I would like a solution that would be the same for every SQL engine.
What do you think about this?
Thanks