Skip to content
OpenDB is utility to manage local, session, cookie in browser.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ex
README.md
README.md~
opendb.js
opendb.min.js
opendbdoc.odt
websql.js

README.md

What is OpenDB ?

OpenDB is utility to manage local, session, cookie in browser.

Browser Support

The numbers in the table specify the first browser version that fully supports Local Storage.

Chrome – 4.0

Ie – 8.0

Mozilla firefox – 3.5

Safari – 4.0

Opera – 11.5

#Use of local and session storage with simple example

<!DOCTYPE html>

<html lang="en">

<head><title>OpenDB</title></head>

<body>

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

<script>

		(function () {

  			// Working is a method to find your browser support localstorage or session storage if supported then you will get true and otherwise false

		console.log(db.working());  // true means you can work on it
		}());
		
</script>

</body>

</html>

Main db object method

working() - checks local storage and session storage working on your system

#Main db object objects

local - Contain localStorage methods

session - Contain sessionStorage methods

cookie - Contain cookie methods

test - Contain testing methods

type – Check type of value

#Local Storage

Stores data with no expiration date

#Session Storage

Stores data for one session (data is lost when the tab is closed)

For more details about local storage and session storage you can read article this article -

Basic information about webstorage

http://www.wayofwebs.com/html/webstorage/

Localstorage techniques

http://www.wayofwebs.com/javascript/local-storage-techniques/

If you are using local storage

db.local.methodname

If you are using session storage

db.session.methodname

Local and Session storage method list

set(key, value) – Sets storage

get(key) - Get storage

has(key) - Checks specified key name and return true or false

remove(key) - Removes specified key name

clean() - Clean all keys from storage

parse(jsonstring) - Parse Json string into javascript object

string(object) - Convert Javascript Object into Json string

setJSON(key, object) – Sets object into key in Json form

getJSON(key) – Get json object as javascript object

trim(key) – Get trim value of storage

count() - Get totle length of storage

key(index) – Get specified index

keys() - Get all keys

setMore(object) – Sets js object into storage

removeMore(array) – Removes array of keys

getMore(array) – Get array of values of keys

counter() - just for static counter

resetCounter() - reset the value of counter

getVLStartWith(string, start, end) – Gets Array of value of key, which contain specified string

getOBStartWith(string, start, end) – Gets Object of key value, which contain specified string

entire() - Gets entire storage as js Object

If you are using Cookie

db.cookie.methodname

WebSQL method list

db.websql.initDB(name, version, description, size) - initialize database

createTable(query) - websql query for crating table

insertRow(query, data, callback) - websql query for inserting data on table

getRows(query, callback) - websql query for get rows of table

deleteRows(query, info, callback) - websql query for delete rows of table

Cookie method list

set(key, value, exdays) – Sets cookie value

get(key) – Get cookie value

has(key) - Checks specified key name and return true or false

entire() - Gets entire cookie

Type Method

type(value) – Gets type of value

You can’t perform that action at this time.