dhbaird / WebSQLShim

WebSQLShim - WebSQL shim over IndexedDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebSQLShim - SQLite/WebSQL SQL Parser

Version 0.0.2 (31.01.2015) Changelog Release plan

Warning

Sorry, work still in progress. Only WebSQL/SQLite SQL parser is ready for the moment.

You can also look at the AlaSQL project with IndexedDB support.

Usage

To use WebSQLShim add the websqlshim.js library to your page:

	<script src="websqlshim.js"></script>
	<script>
	var db = WebSQLShim.openDatabase("mybase",'0.1','',100000);
	db.transaction(function(tx){
		tx.executeSql('SELECT * FROM one WHERE a = ?', [10], function(result){

		}, function(error){
			console.log(error);
		});
	});
	</script>

In case you want to use WebSQLShim as WebSQL shim add this replacement code:

	<script src="websqlshim.js"></script>
	<script>
		if (typeof openDatabase == 'undefined') openDatabase = WebSQLShim.openDatabase;
		//...
		var db = openDatabase("mybase",'0.1','',100000);
		//...
	</script>

SQL parser

WebSQL/SQLite language Jison grammar file and JavaScript parser.

Tests

Use Mocha.js test package. To run tests in Node.js:

    cd test/main    // main function tests
    mocha .

    cd test/parser  // parser tests
    mocha .

Andrey Gershun MIT LICENSE

About

WebSQLShim - WebSQL shim over IndexedDB

License:MIT License


Languages

Language:PLpgSQL 91.2%Language:JavaScript 7.4%Language:Yacc 0.7%Language:ANTLR 0.5%Language:CSS 0.1%Language:HTML 0.0%