Skip to content

agershun/WebSQLShim

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published