Skip to content

A WebSQL / SQLite wrapper for web and cross platform mobile applications.

Notifications You must be signed in to change notification settings

Danbardo/sqLava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqLava

A WebSQL / SQLite wrapper for web and cross platform mobile applications.

Installation

Simple include sqlava.js in your head.

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

Getting started

Creating a database using sqLava is very simple:

sqLava.initDB({
  name:'myDatabase',
  version:1,
  size:25,
  callback:function(r){console.log(r);},
  debug:true,
  jslogic:false
});

Creating tables is also very simple:

sqLava.create({
	table:'arrayTable',
	columns:"column1,column2"
});

Success and error callback handlers can also be included in the parameter object. The parameter within the callback handlers is the SQLResultSet object associated to the transaction.

sqLava.create({
	table:'arrayTable',
	columns:"column1,column2",
	success:function(r){alert("Success!")},
	error:function(r){alert("Error!")
});

To insert data, you simple provide an array representing each row you'd like to add:

sqLava.insert({
	table:'myTable',
	"rows":[
		{
		"column1": "FirstRow",
		"column2": "SecondColumn"
		},
		{
			"column1": "FirstColumn",
			"column2": {
				set:"date()",
				func:true
			}
		}
		]
});

Purpose

sqLava simplifies and reduces the code associated with database transactions. It allows you to perform transactions without writting any SQL or transaction calls. You simply pass in the data you want to add / change / remove and it handles the rest.

It can handle all common database queries

  • Creating tables
  • Inserting into tables
  • Inserting JSON into tables
  • Performing Select queries
  • Updating tables
  • Deleting from tables
  • Exporting tables as JSON, CSV
  • Analysing tables rows, columns
  • Toggling between JavaScript and SQL logic

Examples of these operations can be found in example.js.

Limitations

The browsers which ship with WebSQL are listed here: https://caniuse.com/#feat=sql-storage.

However, most importantly, sqLava / WebSQL can be used in the development of cross platform mobile applications (Cordova).

About

A WebSQL / SQLite wrapper for web and cross platform mobile applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published