问题描述
我有一个使用Sqlite在PC上生成的数据库文件。然后,将该文件传输到基于ARM7的嵌入式系统,而不使用操作系统。嵌入式系统必须访问这个数据库,但不需要更新它。
I have a database file that is generated on a PC using Sqlite. This file is then transferred to an ARM7 based embedded system without an operating system. The embedded system must access this database, but does not need to update it.
我一直试图让sqlite3足够小的嵌入式系统,但到目前为止,我不能获得应用程序大小低于256 Kbytes(我的限制)。
I have been trying to get sqlite3 small enough for the embedded system, but so far I cannot get the application size under 256 Kbytes (my limit).
有谁能够得到sqlite3这个大小?是否有其他软件可以用来读取这个数据库?
Has anyone been able to get sqlite3 down to this size? Is there other software that I can use to read this database?
编辑:我试图使用C访问数据库。这将使用sqlite3_exec 。
I am trying to access the database using C. This would be done using the sqlite3_exec() function.
有两个表。一个表具有ID和文本,第二个表具有ID,链接到第一个表的ID,文本和状态值。所需的唯一访问权限是第一个表上的ID或部分文本,以及第二个表上的ID。
There are two tables. One table has an ID and text, the second an ID, link to ID of first table, text, and status value. The only access required is by ID or partial text on the first table, and by ID on the second table.
也许有一些独立的代码可以用来访问数据库?
Perhaps there is some standalone code that can be used to access the database?
推荐答案
我想出的最小的sqlite3是327千字节(对于PowerPC),这是足够的系统我停止了尝试让它更小。这是完整的sqlite3 CLI二进制文件,单独的C API会有所减少。
The smallest sqlite3 I came up with was 327 KBytes (for PowerPC), which was sufficient for the system so I stopped trying to make it smaller. This was the full sqlite3 CLI binary, the C APIs alone would have been somewhat smaller.
我设置了SQLITE_OMIT_AUTHORIZATION,SQLITE_OMIT_EXPLAIN,SQLITE_OMIT_PROGRESS_CALLBACK和SQLITE_OMIT_TCL_VARIABLE,二进制,并使用-Os得到它的大小。
I had set SQLITE_OMIT_AUTHORIZATION, SQLITE_OMIT_EXPLAIN, SQLITE_OMIT_PROGRESS_CALLBACK, and SQLITE_OMIT_TCL_VARIABLE to trim the size of the binary, and used -Os to get it to that size.
这篇关于Sqlite在嵌入式系统上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!