title: Image not retrieving from sql database in objective c
body: <p>Hello I have been trying to retrieve image from sql database named informationdb.sql but I am not able to,could anyone help with that.Here is my code</p>
  
  <pre><code>- (NSData*) LoadImagesFromSql
  {
      NSData* data = nil;
      directoryPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      documentsDirectory = [directoryPaths objectAtIndex:0];
      NSString * databasePath = [[NSString alloc]initWithString:[documentsDirectory stringByAppendingPathComponent:@"informationdb.sql"]];
  
      int openDatabaseResult = sqlite3_open_v2([databasePath UTF8String], &amp;sqlite3DatabaseObject, SQLITE_OPEN_READWRITE , NULL);
      if (openDatabaseResult == SQLITE_OK) {
           const char* sqlite3Query = "SELECT PHOTO FROM PICTURES";
          int sqlite3Prepare = sqlite3_prepare_v2(sqlite3DatabaseObject, sqlite3Query, -1, &amp;sqlite3Statement, NULL);
      if( sqlite3Prepare == SQLITE_OK )
      {
          const char *myData = sqlite3_column_blob(sqlite3Statement, 1);
          int myDataSize = sqlite3_column_bytes(sqlite3Statement, 1);
          data = [NSData dataWithBytes:myData length:myDataSize];
          sqlite3_step(sqlite3Statement);
      }
           sqlite3_finalize(sqlite3Statement);
      }
      sqlite3_close(sqlite3DatabaseObject);
      return data;
  
  }
  </code></pre>
  
  <p>Thank you.</p>