Objective c 写入sqlite的方法
我试图用一种方法来修改表Objective c 写入sqlite的方法,objective-c,ios,sqlite,Objective C,Ios,Sqlite,我试图用一种方法来修改表 我已经建立了data.db 创建了新组(看起来像文件夹)并将其命名为Documents 将my data.db移动到文档中 4.创建方法: -(void)addItem:(int)itemID { const char *sqlItems=sqlite3_mprintf("UPDATE itemAvailability SET availability=1\ where item
-(void)addItem:(int)itemID {
const char *sqlItems=sqlite3_mprintf("UPDATE itemAvailability SET availability=1\
where itemID=%i",itemID);
sqlite3_stmt *statement;
int sqlResult = sqlite3_prepare_v2(database, sqlItems, -1, &statement, NULL);
if ( sqlResult!= SQLITE_OK)
{
//What I need to implement here?
}
else
{
[self dbConnectionError];
}
sqlite3_finalize(statement);
}
这种方法行不通。我以前从来没有写过。只读取类对象。请提供帮助。查看的Objective-C包装器。
sqlite3\u prepare\u v2不执行您的查询。必须调用sqlite3_步骤(语句)才能执行此操作 这里将详细说明: http://www.sqlite.org/c3ref/step.html 但是。。。正如珍妮佛建议的,我会考虑使用Objto-C包装器。