On Wed, May 7, 2014 at 9:00 AM, Marco Bambini <ma...@sqlabs.net> wrote:

> What is the best way to know if a table has been created with the WITHOUT
> ROWID option?
>


(1) You could send "SELECT rowid FROM table" to sqlite3_prepare() and see
if it returns an error.  This might fail on a table like "CREATE TABLE
xyz(rowid TEXT PRIMARY KEY)WITHOUT ROWID".

(2) Run both "PRAGMA index_list(table)" and "SELECT name FROM sqlite_master
WHERE tbl_name='table'".  If the PRAGMA mentions an
"sqlite_autoindex_table_1" which is not mentioned by the SELECT, then you
have a WITHOUT ROWID table.  This approach is more complex, but never
fails, afaik.


> --
> Marco Bambini
> http://www.sqlabs.com
> http://twitter.com/sqlabs
> http://instagram.com/sqlabs
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to