Hi all,

 

Is there a reason that sqlite3_open() will happily "open" a non-sqlite
file, returning SQLITE_OK, instead of returning SQLITE_NOTADB, which
would seem a more obvious return value?  It will also happily open a
sqlite database that it will later say is corrupt when I try to query
some data, implying it doesn't do data integrity checks on the database
on opening?

 

So... Assuming the above is how sqlite is meant to work, what would be
the best way to ascertain if a successfully opened file is ok to use?
Currently once the file has been opened by sqlite3_open(), and provided
the file existed prior to that call, I then run the query "SELECT
COUNT(rowid) from sqlite_master" and if it fails, I assume the DB is
corrupt or not an sqlite file.  This seems to work, however it seems a
bit long winded and wondered if there was a better way of checking this
kind of thing?

 

Thanks,

Nick.

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

Reply via email to