embedded sqlite server?

I’m thinking about embarking on a long dangerous road… writing a simple embedded sqlite server. Partly for fun (yes I’m a masochist), partly for learning and maybe to actually use it in a few projects. The idea is to provide a class that someone could include in a project, set some properties, compile, and bingo, instant simple DB server. I was thinking of using JSON to communicate with the server.

Is there any interest in such a thing? Would JSON be a good way to communicate? Thoughts? Comments? Harsh words?

Just exploring the idea at the moment…


There is (or was) such a thing whose name escapes me at the moment.

Are you referring to Studio Stable Database? I have the source code to it which I have messed with from time to time.

that is the one.
I have the code somewhere too.
I used it as a customer data store for one project years ago.

Why don’t you use Valentina as SQLite Server? It’s not very expensive.

Json is fine for small amounts of data. Recently I was trying to speed up some code (getting data with AppleScript from Mail). An helper app communictes via Json with the main app. However, the code became even slower. When I had a look with Instruments I could see that half the time was spent with taking the Json apart.

or CubeSQL Server?

Here’s something you might be interested in playing with.

With regards to Beatrix’s point about JSON speed I’ve always used Einhugur’s JSON objects rather than the built in ones (iirc RB didn’t have them originally) and I haven’t really had any issues.

[quote=302454:@Steve Wilson]Here’s something you might be interested in playing with.

With regards to Beatrix’s point about JSON speed I’ve always used Einhugur’s JSON objects rather than the built in ones (iirc RB didn’t have them originally) and I haven’t really had any issues.[/quote]

Very interesting. Thanks for the link!

As far as using cubeSQL and Valentina… cubeSQL is fantastic, haven’t played with Valentina much. CubeSQL is very expensive for distribution and I’m looking for something that can be easily embedded in an application. I’m also interested in doing it as a learning exercise.

I would be cautious with Studio Stable Database. While the author may have left the community and dropped the ball with this customers he may still be retaining copyright. Distributing any source without his permission could be problematic.

Exactly. That is one reason why I’m looking into rolling my own solution.

I’ve been working off and on for a while on a server for sqlite. It’s a project I started to learn about threading, mutexes, semaphores and sockets. I originally used Xojo, then rewrote it in Python and finally settled on Purebasic.

A request received by the server from the client is a json string very similar to what Steve’s solution uses, but due to the overhead of putting the result into a JSON format I opted to use my own format. I do have a method though that will return a JSON format if desired.

Just curious… why Purebasic? I’ve thought about doing it in Python.

I’m not planning on this being an enterprise class server, not even close. This is just for applications that need a small lightweight server with almost zero administration needed.

So, maybe I’ll start with JSON and see if that’s fast enough. But I could see where if you are using a lot of binary data that could be an issue with JSON as you would have to encode it.

[quote=302486:@Phillip Smith]Just curious… why Purebasic?[/quote]I think Johnny’s made a good choice there, PureBasic is great for this kind of work. It’s not that much more difficult to master than Python or Node and you end up with a tiny blisteringly fast executable. If you want to create a console app, server or shared library you really should take a look at PureBasic.

Now that we have an optimizing compiler, have you ever compared code in Purebasic to the same code in Xojo compiled with optimizations on? I would think it might be quite comparable at this point.

For the reasons Steve pointed out above. I couldn’t have said it better.

I would also add to his statements above that Purebasic compiles to a single executable file. There’s no added framework.

So far I’m really happy with the result as far as cpu/memory usage goes.

Maybe someday I’ll have it to the point I would use it in a production app, but to be honest it’s hard to beat CubeSQL for an SQLite server. If I need more that I use Postgresql.

Good Luck With Your Project Phillip.

Hi Philip.

Valentina Server, in both ways VDB Server and SQLite Server, provides you REST API.
this allows you to work with it from anything: JS, Android, Python, Purebasic, etc

Install Valentina Server and get:

  1. Valentina DB Server
  2. SQLite Server
  3. Report Server --> talking to VDB, SQLite, mySQL, postgreSQL, MS SQL Server
  4. KeyValue Store [new in upcoming 7.0]