我在IOS项目中将以下语句写入我的Database Controller类时遇到了问题。
substringFromIndex
我理解需要使用let text = "Suuuuper, {1} has sent {2} a very cool present"
let myTextBefore1 = text.substringToIndex(text.rangeOfString("{1}")!.startIndex) // "Suuuuper, "
let myTextAfter2 = text.substringFromIndex(text.rangeOfString("{2}")!.endIndex) // " a very cool present"
,SELECT * FROM GPSJob WHERE sourceMonitor = '%@' AND positionNumber = %d;
和mysqlite3_open()
,但我无法将我从步骤中提供的值转换为NSString和NSNumber!
答案 0 :(得分:3)
你需要这样的东西:
NSString *querySQL = @"SELECT * FROM GPSJob WHERE sourceMonitor = ? AND positionNumber = ?";
然后对String
使用以下内容 sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
并关注int
sqlite3_bind_int(sqlite3_stmt*, int, int);