On Wed, Jan 22, 2014 at 8:19 AM, Dave Wellman <[email protected]> wrote: > Hi, > Why not use the "create table if not exists" syntax, that way any error must > be classed as 'other'. > Cheers, Thanks Dave. I'll try it.
Jeff > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Jeffrey Walton > Sent: 21 January 2014 17:54 > To: [email protected] > Subject: [sqlite] Differentiate between CREATE TABLE failures (Exists vs > Other Failures?) > > My startup routine attempts to create all needed tables in my database. For > example: > > sqlite3_extended_result_codes(db, 1); > ... > > int rc; > char* err = NULL; > > const char* stmt = "CREATE TABLE users ( " > " userid INTEGER PRIMARY KEY AUTOINCREMENT, " > " username TEXT, usergroup TEXT, " > " hashalg INTEGER, salt BLOB, hmac BLOB, " > " verifier BLOB " > ");"; > rc = sqlite3_exec(db, stmt, NULL, NULL, &err); > > If the table exists, I receive SQLITE_ERROR as a result even with > sqlite3_extended_result_codes. > > Is there a way to get extended error information to differentiate between an > existing table and other errors? Or do I have to parse the error string > returned in `err`? > > Thanks in advance? _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

