I have a function called isadded() and it was the cause of my program crashing. I run debugdiag and found this
Function Arg 1 Arg 2 Arg 3 Source
ntdll!RtlpWaitOnCriticalSection+df 00001484 00000002 00000000
ntdll!RtlEnterCriticalSection+a8 09e10c08 006310a5 09e10c08
sqlite3!sqlite3_mutex_leave+17b 09caf370 0c81d9c8 0063d240
sqlite3!sqlite3_get_table+99 09caf370 0c81d9c8 0c81d9bc
OServHandler!COServHandler::isAdded+17f 059a6fd8 0c8272e0 00000006
OServHandler!COServHandler::getHierarchy+ba7 0c940020 00008000 6009fb27
AdminConsoleInterface!CAdminConsoleInterface::handleConnection+178 00001254 00000000 00000000
AdminConsoleInterface!CAdminConsoleInterface::setOServHandler+33 008c5cd0 0250e9c8 00000000
So, the line where it errs out is sqlite3_get_table().
sprintf_s(query,1024,"SELECT * FROM OServs WHERE oservname = '%s' ;", cOServID);
cout<<query<<endl;
rc = sqlite3_get_table(db, query, &results, &nrow, &ncol, &zErrMsg);
Basically I am trying to see if a particular variable is already added in the database. Is there any alternative to this function since it seems to crash? I remember reading that this function was deprecated, but don’t know what the alternative is.
You use a handful of commands to replace
sqlite3_get_table. Here is the basic c/c++ intro tutorial that explains the process. You have to do more work, but there is much more control.Each one is very well documented in the function section of the sqlite3 reference.
Update:
As an alternative, you can use sqlite3_exec, it is a bit less intense. Here is a small code sample that I found.
http://souptonuts.sourceforge.net/code/simplesqlite3.c.html