Sunday, February 24, 2013

Fixing the 'SQLite compiled ...' problem on OpenWRT

Some users maybe noticed that after installing subversion server on their OpenWRT device (mine is Tp-Link TL-WR1043ND with ATTITUDE ADJUSTMENT (bleeding edge, r31214)) they cannot import or export files to it due to old libsqlite3. So, to fix it, just update the library with the following commands:
opkg update
opkg upgrade libsqlite3

Then stop and start the server with:
/etc/init.d/subversion stop
/etc/init.d/subversion start

There you go - no more sqlite error when transferring files :)

Important: It is possible to face the 'General error 5: database is locked' even when svn server is removed. Probably the reason is somewhere in PDO and usage of newer libsqlite3 version ... Doh

Friday, February 1, 2013

The SQLite Amalgamation and your C++ app are friends ...

... NOT!

  The amalgamation is a single C code file, named "sqlite3.c", that contains all C code for the core SQLite library and the FTS3 and RTREE extensions. This file contains about 110K lines of code (65K if you omit blank lines and comments) and is over 3.8 megabytes in size.

Corresponding to information from http://www.sqlite.org/crew.html , we can find that around 36666.666...7 lines (averaged) from the code are dedicated to each one of the devs. I don't know if there are more devs working on SQLite and I don't care too much, but have a question - we are in year 2013, so why not "sqlite3.cpp"? And why not implemented SOCI library as part of SQLite API?

Now I'm going to think how to embed sqlite3 dll in the executable. Wish me luck!
Edit: One simple solution to statically link sqlite library is to add the files from amalgamation package to 'include/sqlite/' dir of your IDE, add file sqlite3.c to your project and add '#include <sqlite/sqlite3.h>' into 'main.cpp' or whatever source file you choose in your project.