Coder Social home page Coder Social logo

mootools-database's Introduction

Mootools Database Wrapper

Offers a Mootools way to interface with html5 databases (also known as "persistent storage"). Tries to use google gears if no html 5 database is found. It requires Mootools and is tested with v1.2.4.

Screenshot

Demo

You can see a simple demo in this shell.

How to Use

#JS
var db = new Database('Mootools_Database_Demo');
db.execute('SELECT name FROM demo WHERE id = ?;', {
    values: [123],
    onComplete: function(resultSet){
		while(row = resultSet.next()){
			alert(row.get('name')); // You can get columns by key
			alert(row.get(0));      // or by index
		}
	},
	onError: function(error){
		alert('Oops: ' + error.message);
	}
});

/*
 * To make it easier for you to update your app without
 * breaking compatibility with earlier versions of your
 * databases, the Database wrapper supports versioning.
 */
 
if(db.getVersion() == '1.0') {
    db.execute('ALTER TABLE demo RENAME TO production');
    db.changeVersion('1.0', '2.0');
}

Options

  • version - (string: defaults to "1.0") New databases will be created with the given version number.
  • estimatedSize - (int: defaults to 65536) A estimated size, in bytes, of the data to be stored in the database.
  • installGoogleGears - (boolean: defaults to true) If set to true it promps to install google gears.

Limitations

HTML 5 Databases

  • Only the most recent versions of browsers support html 5 storage: FireFox 3.6, Fennec 1.0, Safari 4, Mobile Safari

Google Gears Databases

  • Gears uses SQLite, which has limitations. See the SQLite limitations article on SQLite.org for more information
  • The end user must approve a site to use Gears
  • SQLite supports about 2 GB worth of data
  • Under the hood, large strings must be fragmented as there is a limit to the number of characters that can be written per SQL statement

ToDo

  • begin/end transaction

License

See license file.

Projects using Mootools Database

mootools-database's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mootools-database's Issues

result of set

method Database.ResultSet.Row::get returns "undefined" if col = 0

patch:

if (col == null)
{
return defaultValue;
}
return col;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.