无法执行sqlite3_prepare_v2
我无法执行sqlite3_prepare_v2。当我调试程序时,程序打开 DB ,之后它到达 sqlite3_prepare_v2 。当我单击“继续”时,它会退出 if 循环 &控制权转移到 Finalize 语句。这是我的代码
sqlite3 * 数据库;
if(sqlite3_open([db_path UTF8String], &database)==SQLITE_OK)
{
sqlite3_stmt * compiledstatement;
sqlstmt = @" my select sql query";
if(sqlite3_prepare_v2(database, sqlstmt, -1, &compiledstatement,NULL)==SQLITE_OK)
{
while(sqlite3_step(compiledstatement)==SQLITE_ROW)
{
// select query logic
}
}
sqlite3_finalize(compiledstatement);
}
sqlite3_close(database);
I can not execute sqlite3_prepare_v2. When I debug the program the program opens the DB , after that it comes to sqlite3_prepare_v2 . When I click continue it comes out of if loop & control transfers to finalize statement. Here is my code
sqlite3 * database;
if(sqlite3_open([db_path UTF8String], &database)==SQLITE_OK)
{
sqlite3_stmt * compiledstatement;
sqlstmt = @" my select sql query";
if(sqlite3_prepare_v2(database, sqlstmt, -1, &compiledstatement,NULL)==SQLITE_OK)
{
while(sqlite3_step(compiledstatement)==SQLITE_ROW)
{
// select query logic
}
}
sqlite3_finalize(compiledstatement);
}
sqlite3_close(database);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sqlstmt 是代码中的 NSString。应该是C字符串。更改
为
sqlstmt is an NSString in your code. It should be a C string. Change
to