I noticed the current version of SQLite now supports foreign key constraints. (Previous versions would parse the definition, but not enforce the constraint.) I wanted to take advantage of this in a project I’m working on, but it was oddly a bit convoluted to get there. I don’t know why my installed version was more than three years old (pre v3.6.19, which was released Oct of 2009), but it was definitely time for an upgrade.
Simply downloading and replacing the pre-compiled binary didn’t work well; I lost the functionality of the up arrow key (to recall the previous line), and encountered the escape sequence “^]]A” instead.
Some Google searching led me this answer on Stack Overflow, which was only partly helpful. It essentially says the pre-compiled binary isn’t linked to a readline library, so that support isn’t baked in by default. I’d have to compile from source to get that functionality back. (Why it’s not precompiled that way for a default OS X install, I don’t know.)
If you download the “autoconf” source … then you can compile it via the terminal (cd to the directory the tarball extracts to):
$ sudo make install
Stack Overflow answer by AmbroseChapel
Mid-way into the
./configure, however, the process died as no C compiler was found by the script. Grr. I recently upgraded my computer, and it seems not all of the *nix pieces in the background transferred over as I had hoped.
Supposedly, the easiest way to get these installed is through the preferences dialog in Xcode. It’s an oddly slow download, and kept failing on me at the end with a “Failed to mount … not recognized error.” Repeated attempts yielded the same result. More searching revealed the problem was seemingly common, and solvable by attempting the download through either Tor or a VPN. So, I spent some time trying to get my school’s VPN software installed. (It took about an hour, due to almost no documentation, old software from my school, and wishing to avoid the Cisco client in favor of the OS X native one.) I still ended up with an error after downloading through the VPN, but the install worked this time.
After that, the SQLite config/make process worked just fine … Except the install didn’t overwrite my previous binary but created a new one in a different PATH location. Simply deleting the old one didn’t work (for reasons I don’t entirely understand); the new one would be found by
which, but would not run when the binary was called without the full path. Not wanting to troubleshoot further, I added a soft link to the old path, and the up arrow key now works.
That was a lot of work for a “small” feature.