sqlite3 does NOT guarantee rowid always increments and never gives FULL return 
(at least according to the docs).



autoincrement does.

http://www.sqlite.org/autoinc.html



Michael D. Black

Senior Scientist

NG Information Systems

Advanced Analytics Directorate



________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Stephan Beal [sgb...@googlemail.com]
Sent: Monday, August 22, 2011 9:07 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Last record in db

On Mon, Aug 22, 2011 at 4:01 PM, Cousin Stanley <cousinstan...@gmail.com>wrote:

> > select * from t1 where rowid = max( rowid ) ;
> Error: misuse of aggregate function max()
>

That can be rewritten as:

> select * from t1 order by rowid desc limit 1;

sqlite3 guarantees that the rowid only increments, never decrements. If the
rowid limit is ever hit (very unlikely to happen!) you'll get a "db full"
error, in which case it's probably time to recreate the table to get the
rowid to start counting at 1 again.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to