Sqlite on an embedded system

巧了我就是萌 提交于 2019-11-28 08:42:46

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.

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.

You may want to have a look at cdb it is great for 'constant' data, the code is opensource and will compile to tiny executables, you can even gut it to get the exe smaller. Under 10k should be easy. google cdb

Can you export the database file to a XML or text or another "flat" file? That's much easier to work with in an embedded environment.

I'd try first with sqlite2, it might be leaner (or not). If that doesn't help, I'd say go with your own binary encoding.

Unless your data file is really big, what you lose on SQLite great optimisations, you'll gain by not using SQL.

Of course, use appropriate data structures (most probably a B*Tree or similar).

If you don't need the full power of SQL it might be interesting to look into alternative solutions, like Berkeley DB.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!