I wrote a simple client/server SQLite implementation a while ago - the  
tarball is at http://blog.gornall.net/assets/sqld.tar.bz2 though the  
network-connection to the server is a bit flaky at the moment... It's  
freeware, and comes with (C) server and (Objective C) client code.  
You'll need Apple's Foundation-Lite (or a Mac :-) to link the server  
code though (http://developer.apple.com/opensource/cflite.html).

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 using 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:

+----------------------------------------+
| Packet size : 59 bytes                 |
| Packet type : Authentication           |
| Number of fields : 3                   |
+---------+----------+----------+--------+
|  Type   |  Offset  |  Length  | Value  |
+---------+----------+----------+--------+
|    Text |       48 |        6 | simon  |
|    Text |       54 |        1 |        |
|    Text |       55 |        8 | sqld   |
+---------+----------+----------+--------+

... which corresponds to a client-connection trying to authenticate  
itself against the server (the three fields are 'username',  
'password', 'database').

Simon

On 17 Jun 2008, at 21:59, Alex Katebi wrote:

> Hi John,
>
>    I was writing a message into the socket partially. I had done  
> this to
> avoid coping. This caused many transmissions for a single message.  
> At the
> other end I was doing MSG_PEEK optional flag which was wasteful. I  
> had done
> this to dump the message for debugging.
>
>   By building my message into memory. I was able to send the entire  
> message
> in one socket write. At the other end of the socket I did the
> MSG_WAITALLoptional for the
> recv function. This caused the receiver to be active only when a
> usable message peace was received.
>
> One might say that a misbehaving client could still slow down the  
> server. A
> server should respond with a notification before dropping this  
> client for
> sending runt messages.
>
> What is your design like?
>
> Thanks,
> -Alex
>
>
> On Tue, Jun 17, 2008 at 11:57 AM, John Stanton <[EMAIL PROTECTED]>  
> wrote:
>
>> What did you change?  What was causing the lag?
>>
>> Alex Katebi wrote:
>>> slowness is fixed. Can't tell the difference between client/server  
>>> speed
>>> from library.
>>>
>>> On Sat, Jun 14, 2008 at 8:32 PM, Alex Katebi <[EMAIL PROTECTED]>
>> wrote:
>>>
>>>
>>>> Hi All,
>>>>
>>>>  Looks like there is some interest. I will announce when I  
>>>> release it.
>>>> Currently I am developing an interactive user shell client. This  
>>>> shell is
>>>> used for my client/server development. It can also be embedded  
>>>> for any
>>>> clients user interface.
>>>> The request/response is a little slow for some reason. I need to  
>>>> fix this
>>>> issue.
>>>>
>>>> Thanks,
>>>> -Alex
>>>>
>>>>
>>>>
>>>> On Mon, Jun 2, 2008 at 11:40 AM, Alex Katebi  
>>>> <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am using remote procedure calls (RPC) for SQLite in my  
>>>>> application.
>> I
>>>>> have implemented a few SQLite RPC functions that I needed  
>>>>> successfully.
>>>>> I am wondering if there are other people like me who need this.
>>>>> If there are enough people who could benefit from this I can  
>>>>> make it
>>>>> available as an open source public domain software.
>>>>> Then people can add more functions as needed.
>>>>>
>>>>> Thanks,
>>>>> -Alex
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to