【问题标题】:Multiple SQLite Queries on iOSiOS 上的多个 SQLite 查询
【发布时间】:2011-11-05 12:09:41
【问题描述】:

我有超过 3 个视图。我的数据库如下所示:

    Category:

    CatID | CatTitle
    ----------------
      1   | XYZ
      2   | Sample


    Content:
    ItemID | ItemCatID | ItemText | ItemText2 | ItemText3 | ItemText4
    -----------------------------------------------------------------
      1    |     1     |   Test   |    Bla    |  Sample   |  MoreContent
      2    |     1     |   Test2  |  BlaBla   |  Sample2  |  Other Content
      3    |     2     |   Test3  |  BlaBla2  |  Sample3  |  Other Content2

我想要一个视图,其中第一页类别、第二页列表 (ItemText)、第三页详细信息。

我不知道如何去做。如果我使用 JOIN,我应该在三元组中定义“sqlite3_stmt *compiledStatement”吗?

我认为可以用'For',“get parent,child”(就像java中的光标)来完成?

欢迎任何建议。

【问题讨论】:

    标签: iphone ipad sqlite


    【解决方案1】:

    我不确定你想要什么。 能具体点吗?

    我可以给你两个提示,首先 SQLite 不支持存储过程并且对 PL/SQL 的支持非常有限:http://www.sqlite.org/whentouse.html 如果您真的必须使用它,我建议您看一下,我从未尝试过,但它可能会起作用: http://chriswolf.heroku.com/articles/2011/01/26/adding-stored-procedures-to-sqlite

    其次,您通常想在 SQLite c 函数周围使用 Wrapper,这样您就越来越担心 SQL 本身,而不必担心 c 函数,例如: Best Cocoa/Objective-C Wrapper Library for SQLite on iPhone

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 2012-01-10
      • 1970-01-01
      • 2016-04-23
      • 1970-01-01
      • 2016-09-03
      相关资源
      最近更新 更多