Stub for SQLite operations for IPhone SDK


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. (void) aDBOperation: (NSString*)rName phone:(NSString*) rPhone type:(NSString*)rType
  2. {
  3. if(sqlite3_open([[self dataFilePath] UTF8String],&database) != SQLITE_OK){
  4. sqlite3_close(database);
  5. NSAssert(0, @"Failed to load database");
  6. }
  7.  
  8. NSString* query = [NSString stringWithFormat:@"INSERT QUERY HERE;", param];
  9. sqlite3_stmt *statement;
  10. if(sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK){
  11.  
  12. }
  13. sqlite3_finalize(statement);
  14. NSLog(@"length of returned array %d",[dishes count]);
  15. }
  16. else{
  17. NSLog(@"There was an error loading from db");
  18. }
  19.  
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.