Commit 3885d00b authored by Pavel Vainerman's avatar Pavel Vainerman

(SQLite): добавил принудительное выставление флагов при создании

соединения с БД( вместо умолчательное)
parent ab4e6727
...@@ -59,7 +59,9 @@ bool SQLiteInterface::connect( const string& dbfile, bool create ) ...@@ -59,7 +59,9 @@ bool SQLiteInterface::connect( const string& dbfile, bool create )
// if( !create && !UniSetTypes::file_exist(dbfile) ) // if( !create && !UniSetTypes::file_exist(dbfile) )
// return false; // return false;
int flags = create ? 0 : SQLITE_OPEN_READWRITE; int flags = SQLITE_OPEN_READWRITE;
if( create )
flags |= SQLITE_OPEN_CREATE;
int rc = sqlite3_open_v2(dbfile.c_str(), &db, flags, NULL); int rc = sqlite3_open_v2(dbfile.c_str(), &db, flags, NULL);
...@@ -127,7 +129,7 @@ bool SQLiteInterface::insert( const string& q ) ...@@ -127,7 +129,7 @@ bool SQLiteInterface::insert( const string& q )
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
bool SQLiteInterface::checkResult( int rc ) bool SQLiteInterface::checkResult( int rc )
{ {
if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED || rc==SQLITE_INTERRUPT || rc==SQLITE_IOERR ) if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED || rc==SQLITE_INTERRUPT || rc==SQLITE_IOERR ) // || rc==SQLITE_NOMEM || rc==SQLITE_FULL )
return false; return false;
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment