Hi. I'm using SQLite in my own c++ aplication. Everything works except if I try to do this query:
UPDATE rnc_accounts SET lastip = '127.0.0.1' WHERE name = 'lilezek'; But when I do step I got always 5 (SQLITE_BUSY). You'll think the problem is mine, but I change the query to the next one: SELECT * FROM rnc_accounts WHERE name = 'lilezek'; And it works fine. Any idea? Maybe you need more data. I attach a couple of functions. They are similar, the first one does not work, but the second one does: //db::CreateDB creates db if not exist //typedef string db::Query so db::Query means string //db::OpenDB opens database //db::CloseDB close database //db::DoStep(sqlite_stmt,char *) do step on sqlite_stmt and returns a whole row. The column_count is set on the second argument //db::DoQueryRequest(string, char *) prepares the first argument and return sqlite_stmt. Also set the unprocessed query to char *. //This function does not work. When I do Step, always sql is busy. static bool UpdateIP(string Name, string Ip) { db::faname AccountsFileName; db::fcname Path = db::GetExecPath(); strcpy(&AccountsFileName[0],Path); strcat(&AccountsFileName[0],"accounts.db"); //(curdir)/accounts.db db::CreateDB(&AccountsFileName[0]); if (db::OpenDB(&AccountsFileName[0])!= 0) return false; db::Query qry; qry = "UPDATE rnc_accounts SET lastip = "; qry += db::SqlStr(Ip); qry += " WHERE name = "; qry += db::SqlStr(Name); qry += " ;"; char Datacount,* UPQ; UPQ = new char[100]; while(qry != "") { db::DoStep(db::DoQueryRequest(qry,UPQ),&Datacount); qry = UPQ; } db::CloseDB(); return true; } //But this function works perfectly: static bool CheckPassword(string Name, string Pass) { db::faname AccountsFileName; db::fcname Path = db::GetExecPath(); strcpy(&AccountsFileName[0],Path); strcat(&AccountsFileName[0],"accounts.db"); //(curdir)/accounts.db db::CreateDB(&AccountsFileName[0]); if (db::OpenDB(&AccountsFileName[0])!= 0) return false; db::Query qry; qry = "SELECT pass FROM rnc_accounts WHERE name = "; qry += db::SqlStr(Name); qry += " ;"; string * queryresult; char * Datacount,* UPQ; Datacount = new char[1]; UPQ = new char[100]; while(qry != "") { queryresult = db::DoStep(db::DoQueryRequest(qry,UPQ),Datacount); qry = UPQ; } bool result; if(Datacount[0] > 0) result = (Pass.compare(queryresult[0]) == 0); else result = false; db::CloseDB(); return result; } _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users