将内存中的sqlite数据库转换为blob / char数组 [英] Converting in-memory sqlite database to blob/char array

查看:309
本文介绍了将内存中的sqlite数据库转换为blob / char数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内存中的sqlite数据库,我想转换成一个简单的blob,我想这样做,最好不使用任何序列化库。

I have an in-memory sqlite database which I want to convert to a simple blob, and I want to do this preferably without using any serialization library.

我也使用sqlite api备份调用将其序列化到磁盘,这也可以用于我的目的?

I also use sqlite api backup calls to serialize it to disk, can this also be used for my purpose?

还是,可以简单地将数据库从内存复制到任何其他方式的字符数组? (使用C ++完成开发)

Or, is it possible to simply copy the database from memory to a char array in any other way? (Development is done using C++)

推荐答案

SQLite不能直接访问内存数据库的内部存储。

SQLite does not give you direct access to the internal storage of an in-memory database.

您可以实现您自己的VFS 为一个blob创建一个文件接口,但只是通过一个(临时)磁盘文件听起来容易得多。

You could implement your own VFS to create a 'file' interface for a blob, but just going through a (temporary) disk file sounds much easier.

这篇关于将内存中的sqlite数据库转换为blob / char数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆