Catching SQLITE_NOTADB error in CLI

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Catching SQLITE_NOTADB error in CLI

Hello Group,

I´m trying to intercept the "File is not a DB or encrypted" Error.
In particular, I`m trying the following:

I call the CL Tool under Windows (complied with VC++6) like this 'sqlite3.exe -readTest "encrypted.db" "select foo from bar;"'
The second pass through the command line switches catches the -readTest switch and sets a unsigned int flag "readCheck" from 0 to 1.
That works fine, now
I want to check for that flag at a proper time and if I can not find it, execute the SQL as usuall, but if it is set to 1, i want to try if the  DB is accessible and a valid SQLite3 DB. If thats the case exit(2), exit(1) otherwise.

My external Wrapper will then catch these exitcodes and decide what to do.

I thought the sqlite_open command would return the SQLITE_NOTADB error code but I can´t find the point where the programm gets terminated.

Could anyone point me to the right spot where to look?

Hope that makes sense,

and a happy new Year to all of you!

André Goliath