Posted By

arpit on 06/07/09


Tagged

iphone


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Stub for SQLite operations for IPhone SDK


 / Published in: Objective C
 

  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  

You need to login to post a comment.