AlaSQL

I am currently working on a project to integrate Meteor and SQL. As an initial version of this project, we decided to go with PostgresSQL for the backend version of the SQL database. This choice was mainly due to Postrgres’ “Notify” functionality which gave us an easy way to maintain live data updates between the server and the database. The choice for the front end database was a bit harder to make. First, we had considered using WEB SQL but we quickly found out that not only is there no Firefox support for it, but it’s also been deprecated. We then took a look at IndexedDB and quickly decided against using it, because the entire point of using something different from Mini Mongo for front end storage was to use something that could better handle relational data. IndexedDB’s object storage format was not going to be the solution.

It was during this search that I came across (AlaSQL)[http://alasql.org/]. It turned out to be everything we were looking for and a bit more. Not only didn AlaSQL provide us with a SQL like storage environment which was compatible with all current modern browsers and environments (Chrome, Firefox, Android, Apple), but it also provided us with the same SQL statements we were used to using in the backend: SELECT, INSERT, UPDATE, CREATE, and even JOINS, etc. Not only does it provide you with all this but it is also incredibly easy to use.

All you have to do is add the following script to your html file and you are ready to use it in your code.

HTML:

    <script src="alasql.js"></script>  

JS:

      alasql("CREATE TABLE test (language INT, hello STRING)");
      alasql("INSERT INTO test VALUES (1,'Hello!')");
      alasql("INSERT INTO test VALUES (2,'Aloha!')");
      alasql("INSERT INTO test VALUES (3,'Bonjour!')");
      console.log( alasql("SELECT * FROM test WHERE language > 1") );

That’s it this is all you have to do.

Not only that but the creator of AlaSQL has taken the time to create an user manual for it. Think about this the system, it’s only in its 0.0.43 version and the lead developer has already taken the time to create a dedicated manual and wiki. Now if this isn’t enough to get you guys excited about AlaSQL here’s another thing to consider, it is faster than both WebSQL and SQL.js. It also comes with support for Angular, D3, and once my current project is ready it will be integrated into Meteor.

Please note that AlaSQL is still in development and does still have its bugs. But if you are looking for a database to handle relational database client side you will quickly find out that it is the best option out there. Moreover, if you do come across the occasional bug just do yourself and the developer a favor and instead of getting mad fix the issue and submit a pull request.

Paulo Diniz