NSString *event=@"max";
NSString *venue=@"tvm";
NSString *edate=@"may 6";
NSString *etime=@"10:30";
int admts=5;
NSString *ima=ticobj.iimg;
sqlite3 *database;
databaseName = @"smbhDB.sql";
sqlite3_stmt *addStatement ;
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];
if(addStatement == nil) {
const char *sql ="insert into tickets (admittance, venue, event, date, time, imagedata) Values (?,?,?,?,?,?)";
if(sqlite3_prepare_v2(database, sql, -1, &addStatement, NULL) != SQLITE_OK)
NSAssert1(0, @"444 Error while creating add statement. '%s'", sqlite3_errmsg(database));
}
sqlite3_bind_int(addStatement,1,admts);
sqlite3_bind_text(addStatement, 2, [venue UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStatement, 3, [event UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStatement, 4, [edate UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStatement, 5, [etime UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStatement, 6, [ima UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(addStatement))
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
if(sqlite3_prepare_v2(database, sql, -1, &Statement, NULL) == SQLITE_OK) {
sqlite3_exec(database, sql, -1, &Statement, NULL);
}
sqlite3_reset(addStatement);
Почему я не могу выполнить этот код?