现在我的陈述是这样的:
NSString *sqlJoin = @"SELECT * INTO #tmp FROM foods JOIN bridgeTable ON foods.foodID = bridgeTable.foodID";
if(sqlite3_prepare_v2(database, [sqlJoin UTF8String],
-1, &statement, nil) == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {
}
sqlite3_finalize(statement);
}
else {
NSLog(@"Statement: %s", sqlite3_errmsg(database));
}
NSLog(@"count: %i", [foodArray count]);
我得到的输出是:
2012-07-06 10:32:04.940 ProFitness[7087:f803] Statement: near "INTO": syntax error
2012-07-06 10:32:04.940 ProFitness[7087:f803] count: 0
2012-07-06 10:32:04.940 ProFitness[7087:f803] sql statement: SELECT * FROM #tmp WHERE TableID = '3'
2012-07-06 10:32:04.941 ProFitness[7087:f803] Statement: near "#tmp": syntax error
如果我的语法错误,它应该是什么样子?