I have number of images and i want to store it in sqllite3
database in xcode
. But when I convert it into blob format it is showing a large string to store in database. Please tell me how can I solve this issue and also suggest me the code for that particular method. The Code i used is
我有多个图像,我想将它存储在xcode中的sqllite3数据库中。但是当我将其转换为blob格式时,它会显示一个存储在数据库中的大字符串。请告诉我如何解决这个问题,并建议我使用该特定方法的代码。我使用的代码是
image = [info objectForKey:UIImagePickerControllerEditedImage];
[image_border setImage:image];
imgdata1 = UIImageJPEGRepresentation(image, 1.0f);
NSLog(@"%@",imgdata1);
Anyway to compress it.
无论如何压缩它。
1 个解决方案
#1
0
{
sqlite3_stmt *statement = NULL;
int resultCode = 0;
if (sqlite3_prepare_v2([[ICSSSqliteManager sharedInstance] database], [mySQL cStringUsingEncoding: [NSString defaultCStringEncoding]] , -1, &statement, NULL) == SQLITE_OK){
sqlite3_bind_blob(statement, 1, [data bytes], [data length], SQLITE_TRANSIENT);
resultCode = sqlite3_step(statement);
if (resultCode ==SQLITE_DONE) {
}
sqlite3_finalize(statement);
}
return resultCode;
}
Here data is image data
#1
0
{
sqlite3_stmt *statement = NULL;
int resultCode = 0;
if (sqlite3_prepare_v2([[ICSSSqliteManager sharedInstance] database], [mySQL cStringUsingEncoding: [NSString defaultCStringEncoding]] , -1, &statement, NULL) == SQLITE_OK){
sqlite3_bind_blob(statement, 1, [data bytes], [data length], SQLITE_TRANSIENT);
resultCode = sqlite3_step(statement);
if (resultCode ==SQLITE_DONE) {
}
sqlite3_finalize(statement);
}
return resultCode;
}
Here data is image data