2011-08-28 76 views
0

我有超過3個視圖。我的數據庫看起來是這樣的:iOS上的多個SQLite查詢

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中的遊標)?

歡迎任何建議。

回答

0

我不確定你想要什麼。 你能更具體嗎?

我可以給你,儘管兩個小技巧,首先SQLite不支持存儲過程,並已爲PL/SQL一個非常有限的支持:http://www.sqlite.org/whentouse.html 如果你真的必須使用它,我建議在看這個,我從來沒有嘗試過,但它可能工作: http://chriswolf.heroku.com/articles/2011/01/26/adding-stored-procedures-to-sqlite

第二,你平時想使用SQLite的周圍C函數封裝,所以你不用擔心SQL本身越來越少有關C函數的例子: Best Cocoa/Objective-C Wrapper Library for SQLite on iPhone

希望這有助於