0
我使用類似於下面的代碼插入記錄。插入之後,我將如何從新創建的記錄中獲取主鍵字段值?如何從SQLite3中新創建的記錄中獲取主鍵?
NSString *sql1 = [NSString stringWithFormat:@"INSERT INTO mySets (myimage) VALUES ('4')"];
const char *sqlstring = [sql1 UTF8String];
if (sqlite3_prepare_v2(appDelegate.myDB, sqlstring, -1, &update_statement, NULL) == SQLITE_OK) {
int success = sqlite3_step(update_statement);
if (success != SQLITE_ERROR) {
int createdSet = sqlite3_column_int(update_statement,0);
}
}