On 6 Apr 2017, at 12:11pm, Tim Streater <t...@clothears.org.uk> wrote:

> When my app starts, I check that the file in question actually *is* a 
> database by doing some simple steps like open, selects from important tables, 
> and a read/write to a globals table in the database that contains, for 
> instance, the version number.

Don’t do this.  Because if the file isn’t there, or if the file is there but 
has zero length, SQLite will turn it into a SQLite file and then return results 
which don’t let you tell whether the file was already there or just created.  
And you probably don't want this.

Instead use PHP functions to check that the file exists using PHP function 
"file_exists()" and then using fread() to read the first 16 bytes from it.  
Those 16 bytes should be "SQLite format 3" followed by a 0x00 byte for a string 
terminator.

I’m not sure what you mean by "unconfigured" so I’ll let other people write 
about that, or you can post to clarify.

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

Reply via email to