I trying to make method to alter table.
- I’ve build data.db
- Created new group (looks like folder) and named it Documents
- Moved my data.db into Documents
4 Created method:
-(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);
}
This method doesn’t work. I never was writing before. Only reading into classObject. Please, help.
Take a look at Objective-C wrapper for SQLite.
FMDB
SQLiteManager4iOS