Upgrading Mac OS X default Sqlite database

I usually avoid  compiling my own components, instead opting for pre-compiled Mac Ports. As I’m space constrained this is not  ideal due to all the GNU dependencies it brings down along with what I actually need.

Upgrading the Sqlite3 was relatively painless. However, there are a couple of caveats…

The Sqlite amalgamation file compiles without any problems but will leave you with no ‘command history’, which is a PITA if you’re working with the Sqlite3 command line or console tool.

To get the command history working in Sqlite3, you need readline and ncurses libs. Therefore you need to be working with the ‘sqlite-autoconf*.tar.gz’ version of the source and do the usual

.configure; make; make install

If you’ve been monkeying with your environment path variables, you might need to

sudo cp /usr/bin/sqlite3 /usr/bin/sqlite3.bk

and then

sudo ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3

Everything now seems to be working fine for me on OS X 10.7.5 . I can recall previous commands with the up and down arrow keys and I can use math functions from extended_functions.c with

.load ‘libsqlitefunctions.so’

Note: To compile the extended_functions.c package, download it into the same dir as the sqlite-autoconf source directory, then

gcc -shared -I “.” -o libsqlitefunctions.so extension-functions.c

The “.” path is looking for the sqlite3ext.h file. You can then cp the libsqlitefunctions.so to wherever you need it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s