Categories
Oct 2007
Aug 2007
Jun 2007
May 2007
Apr 2007
Mar 2007
Feb 2007
Dec 2006
Oct 2006
Sep 2006
Aug 2006
Jul 2006
Apr 2006
Mar 2006
Feb 2006
May 2005
RSS
Categories
Oct 2007
Aug 2007
Jun 2007
May 2007
Apr 2007
Mar 2007
Feb 2007
Dec 2006
Oct 2006
Sep 2006
Aug 2006
Jul 2006
Apr 2006
Mar 2006
Feb 2006
May 2005
RSS
Networked SQLite
I've been playing around with SQLite for some time now, and one of the things I thought I'd try out was a client-server version of the database - so here it is. It's a pretty basic implementation, but there was some chatter on the sqlite mailing list, so I thought I'd package it up and release it.

I originally wrote a lot of this in Objective C, with proper classes and methods. In an attempt to make it a bit more portable for those who haven't seen the light, I stepped down to using Foundation and plain-old-C, well apart from the demo client code anyway. ObjC is *so* much nicer than C I had to use it there :) You can get
FoundationLite from Apple's website, and that should be all you need to compile against this source-code.

This is an earlier version of the code I used in a work project, so it has less functionality than the one I have at work, but I may start to fold some of that back in. I guess, as long as I re-implement rather than copy, I'm probably ok. Work are using a whole slew of my code anyway, so I reckon we're even on that score :)

The source is freeware - do with it as you please. If you'd like to credit me somewhere, I certainly wouldn't say no, but that's not necessary.

Run the server with 'sqld -I' to initalise a database in /opt/db, then do 'sqlc -u root -p sqld -d sqld' to connect to the server from a different terminal (there's -h server-hostname as well, if you want to connect via TCP). There's an auth table (initially set up as user=root, password=sqld, database=sqld) and a 'create database' pseudo-command to create new databases (which are just files in the install-dir (/opt/db by default).

This version doesn't have 'show tables', 'desc tablename' etc. The authorisation stuff does work, or at least it should. It doesn't have the change-management feature either (where different connections are notified asynchronously that cols X,Y,Z have changed in rows A,B,C in table T. I'll probably get around to putting those things back in. I think I had server-side plugins working as well - so pseudo-commands could be implemented ung loadable plugins.

It's all based around a simple packet-library concept which abstracts the network-transport. It looks a bit ugly in plain-old-C, but it does work reasonably well. Example packet dump from the server which corresponds to a client-connection trying to authenticate against the server (the three fields are 'username', 'password' and 'database')...



Oct 2007
Aug 2007
Jun 2007
May 2007
Apr 2007
Mar 2007
Feb 2007
Dec 2006
Oct 2006
Sep 2006
Aug 2006
Jul 2006
Apr 2006
Mar 2006
Feb 2006
May 2005
RSS
Categories