On 2/14/20, Wayne Collins <wcol09...@gmail.com> wrote:
> My first posting so I hope I get the etiquette correct.
>
> 1st question How can I determine from a C-program if a table was
> generated with the "WITHOUT ROWID" option? I have an application where
> it is important to know if a table has a rowid or not.

To determine if table XYZ is a WITHOUT ROWID table, run "PRAGMA
index_info('XYZ');".  If you get back one or more rows, then XYZ is a
WITHOUT ROWID table.  If you get back no rows, then XYZ is a rowid
table.


>
> 2nd Question After a database is defined and the tables created, I have
> an application which automatically generates C++ DAO and DTO objects for
> each table. At run time, I'd like to be certain that the schema and the
> DAO/DTO match. I had thought to use the schema_version pragma but it
> increments when the db is VACUUMED. Is there some hidden cookie or value
> I can use that I have overlooked?
>

There are no magic cookies that change with the schema but not with VACUUM.

Perhaps you could store a strong hash of the sqlite_master.sql column
for each table with your C++ objects, then compare the hash upon
reconnect to see if anything has changed.

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

Reply via email to