0

次のように、SQLite3 を使用して iOS XCode で選択を行いたい:

//arraycat is the array from which the data comes...multiple selections of a tableview

pros = [arraycat componentsJoinedByString:@","];

const char *sqlselect = "SELECT DISTINCT zuser.zid, zuser.zplz,zuser.zort,zuser.zhofname,zuser.zstrassenr,zuser.zlatitude,zuser.zlongitude FROM zuser,zangebot,zkategorie WHERE zkategorie.zprodukt IN(?) and zangebot.zprodukte=1 and zkategorie.zuser_id=zuser.zid and zangebot.zuser_id=zuser.zid and zkategorie.zdelete_r=0 and zangebot.zdelete_r=0";

if (sqlite3_prepare_v2(database, sqlselect, -1, &selectStmt, NULL) != SQLITE_OK) {
    NSAssert1(0,@"Failed to prepare statement with message '%s'.", sqlite3_errmsg(database));
    NSLog(@"abfrage select produkt hat nicht geklappt");
}

//here has to be the problem... 
sqlite3_bind_text(selectStmt, 1, [pros UTF8String], -1, SQLITE_STATIC);

テーブルビューでカテゴリを 1 つだけ選択すると機能しますが、複数を選択してこのステートメントに送信すると機能しません。なぜこれ?SQLクエリのカテゴリを手で書くと、それも機能します....メソッドを使用しないのはなぜIN(?)ですか?('Vegetable','fruits')componentsJoinedByString

4

1 に答える 1