SQLike -- a small query engine
June 1, 2010
Download a zip-file (17 kB) with all language versions of SQLike.
SQLike -- demo and short reference. Here you can learn how to use SQLike.
The purpose of SQLike is to provide a tool for this approach that can be used on the clientside in all browsers (even when you do not have access to SQLite that is now getting to be part of some browser environments -- AIR, Safari etc.). SQLike is much slower than SQLite, but a handy alternative for small amounts of data.
SQLike is kind of like SQL
SQLike supports language elements like SELECT, SELECT DISTINCT, WHERE, GROUP BY, ORDER BY, LIMIT, HAVING, UNION, JOINS (a whole bunch of them), INTERSECT, EXCEPT, UPDATE and INSERT INTO.
You will also find aggregate functions like COUNT, SUM, MIN, MAX and AVG.
So if you're familiar with SQL you will not be lost, however you will have to adopt to SQLike syntax. Because...
SQLike is not SQL
SQLike uses SQL-like syntax but not SQL syntax. In SQLike you write your queries as literal objects and the where and set keywords takes JS/AS-functions as arguments. Furthermore you can include JS/AS-functions in your select statements as well.
Another difference is that you don't create or alter tables. Since they are identical to arrays there is no need -- they are easily created outside SQLike.
Furthermore you don't index tables. This might be possible to add to the engine, but I'm not sure if the speed benefits would be huge or how to code an effective index engine as long as the where statement is allowed to be a JS/AS-function, something that I truly like about the API.
The uncompressed version of SQLike is also included in the zip file if you want to play around with it and/or help me develop SQLike further.