iPhone SDK上的sqlite3错误“不是错误”

时间:2021-07-05 05:28:54

Im getting an error "not an error" on iPhone SDK, I spent a whole day trying to resolve it. SQLite version 3.4.0

我在iPhone SDK上收到错误“不是错误”,我花了一整天时间试图解决它。 SQLite版本3.4.0

sqlite3_step(compiledStatement)

The table I'm using in the query has only one row. It returns 100..?

我在查询中使用的表只有一行。它返回100 ..?

sqlite3_errmsg( database )

This line gives me the above error.

这一行给了我上面的错误。

I've created a database and tables in it with terminal commands, and placed in the application resources folder as well as in the documents path, which is done dynamically.

我用终端命令创建了一个数据库和表,并放在应用程序资源文件夹和文档路径中,这是动态完成的。

while(sqlite3_step(compiledStatement) == SQLITE_ROW)

This loops never executes in my code, inside which i get all the values.

这个循环永远不会在我的代码中执行,在其中我得到所有的值。

I think this info is enough, let me know. Anyone know where i'm having the problems..?

我想这个信息已经足够了,让我知道。谁知道我在哪里遇到问题..?

thanks in advance

提前致谢

2 个解决方案

#1


The issue I think you are having is you expect sqlite3_step to return the value from the compiled statement. It doesn't do that, it returns an error code, in this case 100 (SQLITE_ROW), which means the query was successful and there may be more data so you should call the sqlite3_step once you are done getting the data from this step of the query.

我认为你遇到的问题是你希望sqlite3_step从编译语句中返回值。它没有这样做,它返回一个错误代码,在这种情况下是100(SQLITE_ROW),这意味着查询成功,可能有更多的数据,所以你应该在完成从这一步骤获取数据后调用sqlite3_step查询。

If you want to see the actual returned data of that query step you need to use the various sqlite3_column APIs to extract the data from the step.

如果要查看该查询步骤的实际返回数据,则需要使用各种sqlite3_column API从步骤中提取数据。

#2


It's quite simple actually. Have a look at the documentation of sqlite3_step. Basically, SQLITE_ROW tells you that it finished successfully and that another row can be retrieved by calling sqlite3_step again. For the final row, all you get is SQLITE_DONE, which will translate to "not an error".

实际上这很简单。看看sqlite3_step的文档。基本上,SQLITE_ROW告诉您它已成功完成,并且可以通过再次调用sqlite3_step来检索另一行。对于最后一行,您得到的只是SQLITE_DONE,它将转换为“非错误”。

#1


The issue I think you are having is you expect sqlite3_step to return the value from the compiled statement. It doesn't do that, it returns an error code, in this case 100 (SQLITE_ROW), which means the query was successful and there may be more data so you should call the sqlite3_step once you are done getting the data from this step of the query.

我认为你遇到的问题是你希望sqlite3_step从编译语句中返回值。它没有这样做,它返回一个错误代码,在这种情况下是100(SQLITE_ROW),这意味着查询成功,可能有更多的数据,所以你应该在完成从这一步骤获取数据后调用sqlite3_step查询。

If you want to see the actual returned data of that query step you need to use the various sqlite3_column APIs to extract the data from the step.

如果要查看该查询步骤的实际返回数据,则需要使用各种sqlite3_column API从步骤中提取数据。

#2


It's quite simple actually. Have a look at the documentation of sqlite3_step. Basically, SQLITE_ROW tells you that it finished successfully and that another row can be retrieved by calling sqlite3_step again. For the final row, all you get is SQLITE_DONE, which will translate to "not an error".

实际上这很简单。看看sqlite3_step的文档。基本上,SQLITE_ROW告诉您它已成功完成,并且可以通过再次调用sqlite3_step来检索另一行。对于最后一行,您得到的只是SQLITE_DONE,它将转换为“非错误”。