org.cruxframework.crux.core.client.db
Class WSQLAbstractDatabase

java.lang.Object
  extended by org.cruxframework.crux.core.client.db.AbstractDatabase
      extended by org.cruxframework.crux.core.client.db.WSQLAbstractDatabase
All Implemented Interfaces:
Database

public abstract class WSQLAbstractDatabase
extends AbstractDatabase

HTML5 AbstractDatabase based on Web SQL (http://www.w3.org/TR/webdatabase/).

Author:
Thiago da Rosa de Bustamante

Field Summary
protected  SQLDatabase database
           
protected static Logger logger
           
protected  Array<String> objectStoreNames
           
protected  boolean opened
           
 
Fields inherited from class org.cruxframework.crux.core.client.db.AbstractDatabase
errorHandler, messages, name, version
 
Constructor Summary
WSQLAbstractDatabase()
           
 
Method Summary
 void close()
          Close the current database.
protected  void createFileStore(SQLTransaction tx)
           
protected  Transaction createTransaction(String[] storeNames, Transaction.Mode mode)
           
 void delete(DatabaseCallback callback)
          Remove the current database from client browser.
protected  void deleteDBTables(DatabaseCallback callback, SQLTransaction.SQLStatementErrorCallback errorCallback)
           
protected  void deleteDBTables(SQLTransaction tx, DatabaseCallback callback, SQLTransaction.SQLStatementErrorCallback errorCallback, boolean removeSystemTables)
           
protected  void deleteFromDbVersions(DatabaseCallback callback, SQLTransaction.SQLStatementErrorCallback errorCallback)
           
protected  void doDelete(DatabaseCallback callback)
           
protected  void doDelete(DatabaseCallback callback, SQLTransaction.SQLStatementErrorCallback errorCallback)
           
protected  void doOpen(DatabaseCallback callback)
           
protected  SQLTransaction.SQLStatementErrorCallback getDeleteErrorHandler(DatabaseCallback callback)
           
protected abstract
<K,V> WSQLAbstractObjectStore<K,V>
getObjectStore(String storeName, WSQLTransaction transaction)
           
 boolean isOpen()
          Return true if the current database is open.
 boolean isSupported()
          Return true if Crux Database is supported by current browser.
protected abstract  void updateDatabaseStructure(SQLTransaction tx, DatabaseCallback callback)
           
 
Methods inherited from class org.cruxframework.crux.core.client.db.AbstractDatabase
add, add, delete, delete, get, getName, getTransaction, getTransaction, getVersion, open, put, put, setDefaultErrorHandler, setName, setVersion, useIndexedDB, useWebSQL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static Logger logger

opened

protected boolean opened

database

protected SQLDatabase database

objectStoreNames

protected Array<String> objectStoreNames
Constructor Detail

WSQLAbstractDatabase

public WSQLAbstractDatabase()
Method Detail

close

public void close()
Description copied from interface: Database
Close the current database.


delete

public void delete(DatabaseCallback callback)
Description copied from interface: Database
Remove the current database from client browser.

Parameters:
callback - called when operation is completed

isOpen

public boolean isOpen()
Description copied from interface: Database
Return true if the current database is open.

Returns:
true if open

isSupported

public boolean isSupported()
Description copied from interface: Database
Return true if Crux Database is supported by current browser.

Returns:
true if supported

createTransaction

protected Transaction createTransaction(String[] storeNames,
                                        Transaction.Mode mode)
Specified by:
createTransaction in class AbstractDatabase

doOpen

protected void doOpen(DatabaseCallback callback)
Specified by:
doOpen in class AbstractDatabase

doDelete

protected void doDelete(DatabaseCallback callback)

getDeleteErrorHandler

protected SQLTransaction.SQLStatementErrorCallback getDeleteErrorHandler(DatabaseCallback callback)

doDelete

protected void doDelete(DatabaseCallback callback,
                        SQLTransaction.SQLStatementErrorCallback errorCallback)

deleteDBTables

protected void deleteDBTables(SQLTransaction tx,
                              DatabaseCallback callback,
                              SQLTransaction.SQLStatementErrorCallback errorCallback,
                              boolean removeSystemTables)

deleteDBTables

protected void deleteDBTables(DatabaseCallback callback,
                              SQLTransaction.SQLStatementErrorCallback errorCallback)

deleteFromDbVersions

protected void deleteFromDbVersions(DatabaseCallback callback,
                                    SQLTransaction.SQLStatementErrorCallback errorCallback)

createFileStore

protected void createFileStore(SQLTransaction tx)

updateDatabaseStructure

protected abstract void updateDatabaseStructure(SQLTransaction tx,
                                                DatabaseCallback callback)

getObjectStore

protected abstract <K,V> WSQLAbstractObjectStore<K,V> getObjectStore(String storeName,
                                                                     WSQLTransaction transaction)


Copyright © 2014. All rights reserved.