【问题标题】:How to pass an integer data from sqlite database to an integer variable?如何将整数数据从 sqlite 数据库传递给整数变量?
【发布时间】:2014-08-06 22:21:19
【问题描述】:

所以我是 iOS 编程的新手,我想从我的 sqlite 数据库中检索一个整数数据并设置为一个整数变量,我真的没有代码来做这件事,我真的很陌生。我已经搜索了它的任何源代码,但我只能看到检索一个 nsstring,我不能使用它,因为我想知道检索字符串和整数是否有很大差异。谢谢!

【问题讨论】:

  • 在发布这样的问题之前,请尝试做一些研究。从 sqlite.org 上的文档开始或搜索教程。
  • 好的 rmaddy。谢谢!我对此很陌生,我正在自学,我没有任何背景。

标签: ios objective-c sqlite


【解决方案1】:

假设您在语句 stmt 中有一个结果集,并且第一列包含您的 int:

int column_0_value = sqlite3_column_int(stmt, 0);

有关 SQLite C API 的完整列表,请参阅 http://sqlite.org/c3ref/funclist.html

【讨论】:

    猜你喜欢
    • 2013-01-29
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    • 1970-01-01
    • 1970-01-01
    • 2018-08-03
    • 2021-11-12
    • 2013-10-30
    相关资源
    最近更新 更多