替代sqlite3_get_table [英] Alternative to sqlite3_get_table
问题描述
我有一个名为isadded()的函数,这是我的程序崩溃的原因.我运行debugdiag并找到了
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
因此,错误所在的行是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);
基本上,我正在尝试查看数据库中是否已经添加了特定变量.由于此功能似乎崩溃,是否有其他替代方法?我记得读过该功能已被弃用,但不知道替代方法是什么.
您可以使用一些命令来替换sqlite3_get_table
.这是基础c/c ++入门教程,其中介绍了该过程.您必须做更多的工作,但要有更多的控制权.
在 sqlite3参考的功能部分中,每个文档都有很好的记录./p>
更新:
作为替代,您可以使用sqlite3_exec,它的强度稍低一些.这是我发现的一个小代码示例.
http://souptonuts.sourceforge.net/code/simplesqlite3.c.html
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
这篇关于替代sqlite3_get_table的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!