revOpenDatabase Problem

Bob Sneidar bobs at twft.com
Tue Dec 27 13:22:14 EST 2011


Yes you will get an error if you send a query using this construct:

put "SELECT TRUE as CONNECTED" into theSQL

try
  put revDataFromQuery(,,tConnectionID,theSQL) into myResult
catch theError
  answer theError
  exit to top
end try

-- myResult now equals 1

Call something like this right after you "open" the database. The query will fail and throw an error if the file is not a valid sqLite database (or if you are not connected to ANY sql database). if it succeeds, myResult will contain 1. The simple query has the advantage that it will work with any database. 

Bob


On Dec 27, 2011, at 9:50 AM, Pete wrote:

> All good stuff but none of it tells me if I've opened an sqlite database
> :-)  You may have missed the post about opening the file as a regular file
> and checking the first 16 bytes - that's the solution I used, seems to work
> just great.





More information about the use-livecode mailing list