Home > database >  Sqlite3 problems, have not been able to solve it
Sqlite3 problems, have not been able to solve it

Time:10-25

After perform the following function, can't again to update the database (select queries can), please help me to see where the problem is? Thank you
Void Function ()
{
Sqlite3 * db.
Char * zErrMsg=0;
Int rc=0;
Rc=sqlite3_open (CStringToChar (dbFilePath), & amp; Db);
Rc=sqlite3_exec (db, "PRAGMA synchronous=OFF; ", 0, 0);
If (rc)
{
Cstrings STR, str1;
Str1=_T (" can 't open the database: ");
Cstrings str2 (sqlite3_errmsg (db));
STR=str1 + str2;
Warnning MessageBox (NULL, STR, _T (" "), NULL);
return;
}
Rc=sqlite3_exec (db, "begin." , 0, 0);
Char * sqlStatement;
Cstrings stateCString=_T (" SELECT x, y from ") + toGetTableName + _T (";" );
SqlStatement=CStringToChar (stateCString);
Sqlite3_stmt * STMT=NULL;
Int result=sqlite3_prepare_v2 (db, sqlStatement, 1, & amp; STMT, NULL);
If (result==SQLITE_OK)
{
While (sqlite3_step (STMT)==SQLITE_ROW)
{
Double x, y;
X=atof (const char *) sqlite3_column_text (STMT, 0));
Y=atof ((const char *) sqlite3_column_text (STMT, 1));
Int Idnum;
Idnum=atoi ((const char *) sqlite3_column_text (STMT, 2));
}
}
Sqlite3_finalize (STMT);
Sqlite3_exec (db, "commit;" , 0, 0);
Sqlite3_close (db);
}
  • Related