title: Image not store in sqlite
body: <p>I made one demo which stores an Image to the database. Currently I am not getting any error but my image is not store in sqlite database.
  Please see the below code and tell me where is my mistake. </p>
  
  <p><strong>DBManager class</strong></p>
  
  <pre><code>sqlite3 *sqlite3DatabaseObject;
  sqlite3_stmt* sqlite3Statement;
  -(void)database
  {
  
      directoryPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      documentsDirectory = [directoryPaths objectAtIndex:0];
      NSString * databasePath = [[NSString alloc]initWithString:[documentsDirectory stringByAppendingPathComponent:@"informationdb.sql"]];
      NSFileManager *fileManager = [NSFileManager defaultManager];
      if ([fileManager fileExistsAtPath:databasePath] == NO) {
          const char *dbPath = [databasePath UTF8String];
          if (sqlite3_open(dbPath, &amp;sqlite3DatabaseObject)== SQLITE_OK) {
              char * errorMessage;
              const char *sqlite3Query = "CREATE TABLE IF NOT EXISTS PICTURES (PHOTO BLOB)";
              if (sqlite3_exec(sqlite3DatabaseObject, sqlite3Query, NULL, NULL, &amp;errorMessage)!= SQLITE_OK) {
                  NSLog(@"failed = %@",sqlite3DatabaseObject);
              }
              sqlite3_close(sqlite3DatabaseObject);
          }else{
              NSLog(@"failed to create database");
          }
      }
  }
  - (void) SaveImagesToSql: (NSData*) imgData  {
  
      NSString *databasePath = [[NSBundle mainBundle] pathForResource:@"informationdb" ofType:@"sql"];
  
      const char* sqlite3Query = "INSERT INTO PICTURES (PHOTO) VALUES (?)";
      int openDatabaseResult = sqlite3_open_v2([databasePath UTF8String], &amp;sqlite3DatabaseObject, SQLITE_OPEN_READWRITE , NULL);
      if (openDatabaseResult == SQLITE_OK) {
          int sqlite3Prepare = sqlite3_prepare_v2(sqlite3DatabaseObject, sqlite3Query, -1, &amp;sqlite3Statement, NULL);
          if( sqlite3Prepare == SQLITE_OK ) {
              sqlite3_bind_blob(sqlite3Statement, 1, [imgData bytes], [imgData length], SQLITE_TRANSIENT);
              sqlite3_step(sqlite3Statement);
          }
          else
          {
              NSLog(@"Error is: %s", sqlite3_errmsg(sqlite3DatabaseObject));
          }
          sqlite3_finalize(sqlite3Statement);
  
      }
      else NSLog( @"Error is:  %s", sqlite3_errmsg(sqlite3DatabaseObject) );
      sqlite3_close(sqlite3DatabaseObject);
  }
  </code></pre>
  
  <p><strong>ViewController class</strong>  </p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      DBManager * dbmClass = [[DBManager alloc]init];
      [dbmClass database];
  
      imgView.userInteractionEnabled = YES;
      UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(uploadOrCapture)];
      [singleTap setNumberOfTapsRequired:1];
      [imgView addGestureRecognizer:singleTap];
  
  }
  - (IBAction)btnSave:(id)sender {
      DBManager*dbmClass = [[DBManager alloc]init];
      NSData *imageInData = UIImagePNGRepresentation(imgView.image);
      [dbmClass SaveImagesToSql:imageInData];
      [self dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>
  
  <p>I am not able to find out the issue. It successfully executes all the code but when I download the database from device and checked, there is no image data stored.</p>
  
  <p>Thanks in advance.<br>
  Mihir.</p>