SQLite Server
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
SQLite Server
I have created a little server based on SQLite. It communicates with it's clients using TCP sockets and the following control codes (subject to revision):
Client Control Codes
Codes Sent To Server
Chr(3) SQL Statement Separator
Chr(4) End Of Transmission
Chr(5) User Name and Password Should Precede This Code Separated By Chr(31)
Chr(20) The Buffer Contains SELECT Statements
Chr(21) The Buffer Contains DELETE, INSERT or UPDATE Statements
Codes Received From Server
Chr(3) Separator Used To Delimit The Responses To Multiple SELECT Statements
Chr(4) End Of Transmission
Chr(6) Successful Update
Chr(20) Record Separator
Chr(21) Error
Chr(31) Field Separator
Server Control Codes
Codes Sent To Client
Chr(3) Separator Used To Delimit The Responses To Multiple SELECT Statements
Chr(4) End Of Transmission
Chr(6) Successful Update
Chr(20) Record Separator
Chr(21) Error
Chr(31) Field Separator
Codes Received From Client
Chr(3) SQL Statement Separator
Chr(4) End Of Transmission
Chr(5) User Name and Password Should Precede This Code Separated By Chr(31)
Chr(20) The Buffer Contains SELECT Statements
Chr(21) The Buffer Contains DELETE, INSERT or UPDATE Statements
If you'd like a go with a free beta version (max 3 active sockets) please send me a private message and I will e-mail it to you.
Once any bugs are ironed out I plan to release a version that will avail >25 active sockets for a nominal fee.
The server does not provide any locking over and above that provided by SQLite, if it receives simultaneous requests to update it simply queues them and deals with them one at a time. Simultaneous reads are no problem.
Because the course grain locking provided by SQLite is so simplistic, i.e. the whole database, it doesn't add much overhead and updates are extremely quick. When you have a small workgroup of users this method is usually quicker than allowing multiple simultaneous updates using complicated field-level or even record-level locking algorithms.
You can also set-up the server to only accept connections from a list of IP addresses, or from a list of users with passwords or a combination of the two. If you don't set-up these lists it will accept connections from any client who sends a request on the specified port.
When you send a group of updates, separated by Chr(3) and terminated by Chr(4), they are automatically encapsulated into a transaction. If the update fails it will be rolledback you will receive the error control code Chr(21) along with the database engine error message and the sql statement that caused the exception separated by Chr(20).
You can also submit multiple select statements separated in the same way which is great for lookups.
It's been a while since I used PureBasic, but if it still has the 64K string length limit you may need to take this into consideration when requesting large recordsets.
Client Control Codes
Codes Sent To Server
Chr(3) SQL Statement Separator
Chr(4) End Of Transmission
Chr(5) User Name and Password Should Precede This Code Separated By Chr(31)
Chr(20) The Buffer Contains SELECT Statements
Chr(21) The Buffer Contains DELETE, INSERT or UPDATE Statements
Codes Received From Server
Chr(3) Separator Used To Delimit The Responses To Multiple SELECT Statements
Chr(4) End Of Transmission
Chr(6) Successful Update
Chr(20) Record Separator
Chr(21) Error
Chr(31) Field Separator
Server Control Codes
Codes Sent To Client
Chr(3) Separator Used To Delimit The Responses To Multiple SELECT Statements
Chr(4) End Of Transmission
Chr(6) Successful Update
Chr(20) Record Separator
Chr(21) Error
Chr(31) Field Separator
Codes Received From Client
Chr(3) SQL Statement Separator
Chr(4) End Of Transmission
Chr(5) User Name and Password Should Precede This Code Separated By Chr(31)
Chr(20) The Buffer Contains SELECT Statements
Chr(21) The Buffer Contains DELETE, INSERT or UPDATE Statements
If you'd like a go with a free beta version (max 3 active sockets) please send me a private message and I will e-mail it to you.
Once any bugs are ironed out I plan to release a version that will avail >25 active sockets for a nominal fee.
The server does not provide any locking over and above that provided by SQLite, if it receives simultaneous requests to update it simply queues them and deals with them one at a time. Simultaneous reads are no problem.
Because the course grain locking provided by SQLite is so simplistic, i.e. the whole database, it doesn't add much overhead and updates are extremely quick. When you have a small workgroup of users this method is usually quicker than allowing multiple simultaneous updates using complicated field-level or even record-level locking algorithms.
You can also set-up the server to only accept connections from a list of IP addresses, or from a list of users with passwords or a combination of the two. If you don't set-up these lists it will accept connections from any client who sends a request on the specified port.
When you send a group of updates, separated by Chr(3) and terminated by Chr(4), they are automatically encapsulated into a transaction. If the update fails it will be rolledback you will receive the error control code Chr(21) along with the database engine error message and the sql statement that caused the exception separated by Chr(20).
You can also submit multiple select statements separated in the same way which is great for lookups.
It's been a while since I used PureBasic, but if it still has the 64K string length limit you may need to take this into consideration when requesting large recordsets.
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
CSAUER has very kindly offered to provide some links for downloading and for a few screenshots.
Versions are available for Win32, Linux and Mac OSX (although the Linux and Mac versions are completely untested).
I have also created a demo client in PureBasic, the source will be included in the download.
Please check back after the weekend.
Thanks.
Weave
Versions are available for Win32, Linux and Mac OSX (although the Linux and Mac versions are completely untested).
I have also created a demo client in PureBasic, the source will be included in the download.
Please check back after the weekend.
Thanks.
Weave
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Here are the download links for the SQLite server:
Windows version http://www.xideas.de/purebasic/S4SWin.zip
Linux version http://www.xideas.de/purebasic/S4SLinux.zip
Mac version http://www.xideas.de/purebasic/S4SMac.zip
Thanks to CSAUER for providing these.
Windows version http://www.xideas.de/purebasic/S4SWin.zip
Linux version http://www.xideas.de/purebasic/S4SLinux.zip
Mac version http://www.xideas.de/purebasic/S4SMac.zip
Thanks to CSAUER for providing these.
the.weavster,
Just so you know: the 64k string limit is removed in version 4.
http://freak.purearea.net/v4/ReadMe.html
Just so you know: the 64k string limit is removed in version 4.
http://freak.purearea.net/v4/ReadMe.html
Last edited by GedB on Tue Mar 07, 2006 4:30 pm, edited 1 time in total.
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Has anyone tried this in a true multi-user environment?
And, why aren't you selling this weav? Everyone on the web seems to believe that SQLite is single-user only. Its one of its main drawbacks, but this seems to solve that problem, and be multi-platform! Am I correct in this assumption?
EDIT:
I found these guys, but they are Windows only and are not even selling it yet:
http://www.terrainformatica.com/sqlited ... /main.whtm
and the another you have to get with a "different" basic package:
http://www.realsoftware.com/news/pr/2005/sqlabs
And, why aren't you selling this weav? Everyone on the web seems to believe that SQLite is single-user only. Its one of its main drawbacks, but this seems to solve that problem, and be multi-platform! Am I correct in this assumption?
EDIT:
I found these guys, but they are Windows only and are not even selling it yet:
http://www.terrainformatica.com/sqlited ... /main.whtm
and the another you have to get with a "different" basic package:
http://www.realsoftware.com/news/pr/2005/sqlabs
- the.weavster
- Addict
- Posts: 1576
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
I didn't get much feedback so I didn't push it. For nearly a year now I've been working on a project that's much more important to me - a business information system to compete with SAP BusinessOne or Sage MMS.Straker wrote:why aren't you selling this weav?
Right on both counts, multi-user and multi-platform.Straker wrote:Everyone on the web seems to believe that SQLite is single-user only. Its one of its main drawbacks, but this seems to solve that problem, and be multi-platform! Am I correct in this assumption?
The SQLabs server you mentioned has been bought out by REALbasic and I believe it now only works with RB (and it's a ridiculous price).
I did make some improvements on the version I originally made available for download here; a way of handling Insert IDs and a command so you could use the server locally and tell it to quit when you're done.
I also made a client library (a *.dll with a PureBasic wrapper) which I tried (and failed) to tailbite into a proper PB library, maybe I'll give that another go.
If I get a chance I'll post a new link over the weekend.
I'm interested also.
We use Sage's BusinessVision and I've been toying with the idea of an alternative package.
I recently purchased Michael Owen's "The Definitve Guide to SQLITE" and it is teaming with good information.
I've downloaded the zip and will try it out.
Thanks,
--blueb
We use Sage's BusinessVision and I've been toying with the idea of an alternative package.
I recently purchased Michael Owen's "The Definitve Guide to SQLITE" and it is teaming with good information.
I've downloaded the zip and will try it out.
Thanks,
--blueb
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem