1个回答
2015-03-19
展开全部
const char * sequel = "select image from test_table where name=?";
sqlite3_stmt * getimg;
if (sqlite3_prepare_v2(database, sequel, -1, &getimg, NULL) == SQLITE_OK)
{
char *name = "test";
sqlite3_bind_text(update, 1, name, -1, NULL);
if(sqlite3_step(getimg) == SQLITE_ROW)
{
int bytes = sqlite3_column_bytes(getimg, 0);
Byte * value = (Byte*)sqlite3_column_blob(getimg, 1);
if (bytes !=0 && value != NULL)
{
NSData * data = [NSData dataWithBytes:value length:bytes];
UIImage * img = [UIImage imageWithData:data];
UIImageView * aview =[[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, IMAGE_WIDTH, IMAGE_HEIGHT)];
aview.image = img;
[self.view addSubview:aview];
[aview release];
}
}
sqlite3_finalize(getimg);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询