sqlite3 是否支持从字符串/字节而不是文件加载? [英] Does sqlite3 support loading from string/bytes instead of file?

查看:33
本文介绍了sqlite3 是否支持从字符串/字节而不是文件加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sqlite3 支持从 .db 文件转储和打开,文件实际上是一个字符串/字节的容器,所以我有这个问题.

sqlite3 supports dumping to and opening from .db file and file is actually a container of string/bytes, so I have the question.

我将 .db 文件存储在 cdn 服务器上并有一个客户端(可能是 pythonjavascriptruby) 发送 HTTP 请求.收到 HTTP 响应后,我打算从响应正文打开一个临时数据库,而不是将其保存到文件并从文件中打开.在这种情况下,所有操作都在内存中完成,无需访问本地文件系统.这是可能的还是我走错了路?

I store .db file on cdn server and have a client (maybe python, javascript or ruby) to send HTTP request. After having received HTTP response, I intend to open a temporary db from response body instead of saving it to file and opening from file. In this case, all is done in memory without access to local file system. Is this possible or I am going the wrong way?

推荐答案

这可以通过函数 sqlite3_deserialize(),如果你使用的是 C.

This would be possible with the function sqlite3_deserialize(), if you were using C.

这篇关于sqlite3 是否支持从字符串/字节而不是文件加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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