保存到磁盘上的内存数据库 [英] Saving to disk an in-memory database

查看:154
本文介绍了保存到磁盘上的内存数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在sqlite的C ++做了一个数据库。

I made a database through sqlite in c++.

该数据库已经在内存中创建(使用:记忆:参数insted的一个文件名),为了有一个非常快的行为

The db has been created in memory (using the ":memory:" parameter insted of a filename), in order to have a very quick behavior.

该数据库由以下行创建:

The database is created by the following lines:

sqlite3* mem_database;
if((SQLITE_OK == sqlite3_open(":memory:", &mem_database)){
    // The db has been correctly created and
    // I can do some stuff with it.
}
sqlite3_close(mem_database);

我的问题是:我怎么能写的内存数据库到磁盘? (通过当然是C / C ++)。

My problem is: how can I write the in-memory database to disk? (through c/c++ of course).

我读了一些关于连接和断开sqlite的命令,但我可以让他们只与SQLite的交互式shell(而不是从C / C ++ code)。

I read something about the ATTACH and DETACH sqlite commands, but I can get them working only with the sqlite interactive shell (not from c/c++ code).

映入眼帘。

推荐答案

看看这个例子:加载和保存在内存数据库

这篇关于保存到磁盘上的内存数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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