嵌入式系统上的 Sqlite [英] Sqlite on an embedded system

查看:165
本文介绍了嵌入式系统上的 Sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 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 KB(我的限制).

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 KBytes(对于 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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