写入:
NSArray *paths = NSSearchPathForDirectorIEsInDomains(NSdocumentDirectory,NSUserDomainMask,YES);
Nsstring *dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@”sqlite.sqlite”];
NSData *image=UIImagePNGRepresentation([UIImage imagenamed:@"01_02.png"]);
Nsstring *aaa=[[Nsstring alloc]initWithFormat:@”update cards set c_image=? where ID=1″];
sqlite3 *database;
if (sqlite3_open([dataPath UTF8String],&database) == sqlITE_OK){
sqlite3_stmt * complIEdStatement;
sqlite3_prepare(database,[aaa UTF8String],-1,&complIEdStatement,0);
sqlite3_bind_blob(complIEdStatement,1,[image bytes],[image length],NulL);
int result=sqlite3_step(complIEdStatement);
if (result==sqlITE_DONE) {
}
sqlite3_finalize(complIEdStatement);
}
sqlite3_close(database);
[aaa release];
读取:
}
else{
} } } sqlite3_finalize(complIEdStatement); } sqlite3_close(database);
总结以上是内存溢出为你收集整理的sqlite中写入图片二进制数据及读取源码 for iphone全部内容,希望文章能够帮你解决sqlite中写入图片二进制数据及读取源码 for iphone所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)