修改 sqlite 中的二进制文件 如下:
1.执行修改语句 update tb set content=? where id=x
2.重新设置参数长度 sqlite3_bind_zeroblob(stmt, 1, len); 第三个参数就是修改后的长度。//bind_zeroblob可以用于几个G的数据写入
3. SQLITE_API int sqlite3_blob_open(
sqlite3*, //数据库句柄
const char *zDb, //数据库名称
const char *zTable, //表名
const char *zColumn, //列名
sqlite3_int64 iRow, //行号
int flags, //If the flags parameter is non-zero, then the BLOB is opened for read and write access.If it is zero, the BLOB is opened for read access.
sqlite3_blob **ppBlob // 二进制文件句柄
);
主要目的: 获得需要修改行的文件句柄;
4. sqlite3_blob_write(..) 写入数据; // 在sqlite3_blob_open之后你可以任意次调用sqlite3_blob_write写入数据,只要不超过sqlite3_bind_zeroblob中设定的长度就可以了。
5.sqlite3_blob_close关闭
以上为获取自网上主键,总感觉不如直接删除,然后插入一个新的来方便; 或者在某些不能项里面有用吧!
2.执行修改语句 update tb set content=? where id=x
3.重新设置参数长度 sqlite3_bind_zeroblob(stmt, 1, len); 第三个参数就是修改后的长度。//bind_zeroblob可以用于几个G的数据写入