Database Class
Exposes methods to deal with database. It has methods to create, delete, and perform other common database management tasks.
Item Index
Methods
- avg
- count
- delete
- getColumnNames
- getColumnNamesAsync
- getColumnTypes
- getColumnTypesAsync
- getDatabaseDescriptor
- getDatabaseDescriptorAsync
- getEntityDescriptor
- getEntityDescriptor
- getForeignKeys
- getForeignKeysAsync
- getMandatoryFields
- getMandatoryFieldsAsync
- getPrimaryKeys
- getPrimaryKeysAsync
- getTableName
- getTableNameAsync
- getUniqueFields
- getUniqueFieldsAsync
- groupConcat
- max
- min
- save
- saveAsync
- saveOrUpdate
- saveOrUpdateAsync
- select
- sum
- total
- update
- updateAsync
Methods
avg
                                            
                                                    ()
                                            
                                                    
                                                        IAverage
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the average based on column name provided.
    Example:
                                                    var average = 0;
                                                    
                                                    try {
                                                        average = new Book().avg()
                                                                    .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
IAverage to provide extra information based on which average will be calculated.
count
                                            
                                                    ()
                                            
                                                    
                                                        ICount
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the count of rows based on information provided.
    Example:
                                                    var count = 0;
                                                    
                                                    try {
                                                        count = new Book().count().
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                        
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
ICount to provide extra information based on which count will be calculated.
delete
                                            
                                                    ()
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                It deletes a record to any single table in a relational database.
Example:
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(beer_link));
                                            
                                            try {
                                                cBook.delete();
                                            } catch(DatabaseException de) {
                                                //Log it.
                                            }
                                                    
                                            OR
                                                    
                                            try {
                                                new Book().delete().execute();
                                            } catch(DatabaseException de) {
                                                //Log It.
                                            }getColumnNames
                                            
                                                    ()
                                            
                                                    
                                                        Array
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all column names of mapped table.
    Example:
                                                    var columnNames = null;
                                                    try {
                                                        columnNames = new Book().getColumnNames();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All column names of mapped table.
getColumnNamesAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all column names of mapped table.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getColumnNamesCallback = function Callback();
                                                            getColumnNamesCallback.onSuccess = function(columnNames) {
                                            
                                                            }
                                            
                                                            new Book().getColumnNamesAsync(getColumnNamesCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getColumnNamesAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getColumnTypes
                                            
                                                    ()
                                            
                                                    
                                                        Dictionary
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all columns with there data types for invoked class object.
    Example:
                                                    var columnTypes = null;
                                                    try {
                                                        columnTypes = new Book().getColumnTypes();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All columns with there data types.
getColumnTypesAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all columns with there data types for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getColumnTypesCallback = function Callback();
                                                            getColumnTypesCallback.onSuccess = function(columnNames) {
                                            
                                                            }
                                            
                                                            new Book().getColumnTypesAsync(getColumnTypesCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getColumnTypesAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getDatabaseDescriptor
                                            
                                                    ()
                                            
                                                    
                                                        DatabaseDescriptor
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns database descriptor object based on the POJO class called.
    Example:
                                                
                                                    try {
                                                        DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                    } catch(DatabaseException databaseException) {
                                                        //Log It.
                                                    }Returns:
Database Descriptor Object.
getDatabaseDescriptorAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous database descriptor object based on the POJO class called.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function() {
                                            
                                                            var getDatabaseDescriptorCallback = new Callback();
                                                            getDatabaseDescriptorCallback.onSuccess = function(databaseDescriptor) {
                                            
                                                            }
                                            
                                                            new Lession().getDatabaseDescriptorAsync(getDatabaseDescriptorCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        var databaseDescriptor = new Book().getDatabaseDescriptor();
                                                        Database.beginTransactionAsync(databaseDescriptor, callback);
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(databaseDescriptor) {
                                            
                                                        }
                                            
                                                        new Book().getDatabaseDescriptorAsync(callback);Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getEntityDescriptor
                                            
                                                    ()
                                            
                                                    
                                                        EntityDescriptor
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the actual entity descriptor object mapped for invoked class object.
    Example:
                                                    EntityDescriptor entityDescriptor = null;
                                                    try {
                                                        entityDescriptor = new Book().getEntityDescriptor();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
Entity Descriptor Object
getEntityDescriptor
                                            
                                                    ()
                                            
                                                    
                                                        EntityDescriptor
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns asynchronous the actual entity descriptor object mapped for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function() {
                                            
                                                            var getEntityDescriptorCallback = new Callback();
                                                            getEntityDescriptorCallback.onSuccess = function(entityDescriptor) {
                                            
                                                            }
                                            
                                                            new Lession().getEntityDescriptorAsync(getEntityDescriptorCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        var databaseDescriptor = new Book().getDatabaseDescriptor();
                                                        Database.beginTransactionAsync(databaseDescriptor, callback);
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(entityDescriptor) {
                                            
                                                        }
                                            
                                                        new Book().getEntityDescriptorAsync(callback);Returns:
Entity Descriptor Object
getForeignKeys
                                            
                                                    ()
                                            
                                                    
                                                        Array
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all foreign keys of mapped table for invoked class object.
    Example:
                                                                
                                                    var foreignKeys = null;
                                                    try {
                                                        foreignKeys = new Book().getForeignKeys();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All foreign keys of mapped table.
getForeignKeysAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all foreign keys of mapped table for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getForeignKeysCallback = function Callback();
                                                            getForeignKeysCallback.onSuccess = function(primaryKeys) {
                                            
                                                            }
                                            
                                                            new Book().getForeignKeysAsync(getForeignKeysCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getForeignKeysAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getMandatoryFields
                                            
                                                    ()
                                            
                                                    
                                                        Array
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all mandatory fields which are associated with mapped table for invoked class object.
    Example:
                                                    var mandatoryFields = null;
                                                    try {
                                                        mandatoryFields = new Book().getMandatoryFields();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All mandatory fields for mapped table.
getMandatoryFieldsAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all mandatory fields which are associated with mapped table for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getMandatoryFieldsCallback = function Callback();
                                                            getMandatoryFieldsCallback.onSuccess = function(primaryKeys) {
                                            
                                                            }
                                            
                                                            new Book().getMandatoryFieldsAsync(getMandatoryFieldsCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getMandatoryFieldsAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getPrimaryKeys
                                            
                                                    ()
                                            
                                                    
                                                        Array
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all primary keys of mapped table for invoked class object.
    Example:
                                                    var primaryKeys = null;
                                                    try {
                                                        primaryKeys = new Book().getPrimeryKeys();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All primary keys.
getPrimaryKeysAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all primary keys of mapped table for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getPrimaryKeysCallback = function Callback();
                                                            getPrimaryKeysCallback.onSuccess = function(primaryKeys) {
                                            
                                                            }
                                            
                                                            new Book().getPrimaryKeysAsync(getPrimaryKeysCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getPrimaryKeysAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getTableName
                                            
                                                    ()
                                            
                                                    
                                                        String
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the mapped table name for invoked class object.
    Example:
                                                    var tableName = null;
                                                    try {
                                                        tableName = new Book().getTableName();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
Mapped Table name.
getTableNameAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous the mapped table name for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getTableNameCallback = function Callback();
                                                            getTableNameCallback.onSuccess = function(tableName) {
                                            
                                                            }
                                            
                                                            new Book().getTableName(getTableNameCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getTableNameAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
getUniqueFields
                                            
                                                    ()
                                            
                                                    
                                                        Array
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns all unique fields which are associated with mapped table for invoked class object.
    Example:
                                                                
                                                    var uniqueFields = null;
                                                    try {
                                                        uniqueFields = new Book().getUniqueFields();
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
All unique fields for mapped table.
getUniqueFieldsAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
Returns asynchronous all unique fields which are associated with mapped table for invoked class object.
    Example:
                                            
                                                    - Using Transaction
                                            
                                                        var callback = new Callback();
                                                        callback.onExecute = function(transaction) {
                                            
                                                            var getUniqueFieldsCallback = function Callback();
                                                            getUniqueFieldsCallback.onSuccess = function(primaryKeys) {
                                            
                                                            }
                                            
                                                            new Book().getUniqueFieldsAsync(getUniqueFieldsCallback, transaction);
                                                        }
                                            
                                                        callback.onSuccess = function() {
                                            
                                                        }
                                            
                                                        callback.onFailure = function() {
                                            
                                                        }
                                            
                                            
                                                        try {
                                                            DatabaseDescriptor databaseDescriptor = new Book().getDatabaseDescriptor();
                                                            Database.beginTransactionAsync(databaseDescriptor, callback);
                                                        } catch(DatabaseException de) {
                                                            //Log it.
                                                        }
                                            
                                            
                                                    - Using Callback
                                            
                                                        var callback = new Callback();
                                                        callback.onSuccess = function(tableName) {
                                            
                                                        }
                                            
                                                        try {
                                                            new Book().getUniqueFieldsAsync(callback);
                                                        } catch(e) {
                                            
                                                        }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
groupConcat
                                            
                                                    ()
                                            
                                                    
                                                        IGroupConcat
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the group concat based on column name provided.
    Example:
                                                    var groupConcat = 0;
                                                    
                                                    try {
                                                        groupConcat = new Book().groupConcat()
                                                                        .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                        .where(Book.TITLE).equalTo("C")
                                                                        .execute();
                                                                        
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
IGroupConcat to provide extra information based on which group concat will be calculated.
max
                                            
                                                    ()
                                            
                                                    
                                                        IMax
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the minimum based on column name provided.
    Example:
                                                    var maximum = 0;
                                                    
                                                    try {
                                                        maximum = new Book().max()
                                                                    .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                        
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
IMax to provide extra information based on which maximum will be calculated.
min
                                            
                                                    ()
                                            
                                                    
                                                        IMin
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the minimum based on column name provided.
    Example:
                                                    var minimum = 0;
                                                    
                                                    try {
                                                        minimum = new Book().min()
                                                                    .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                        
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
IMin to provide extra information based on which minimum will be calculated.
save
                                            
                                                    ()
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                It adds a record to any single table in a relational database.
    <pre>
                                            Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(c_link));
                                            
                                            try {
                                                cBook.save();
                                            } catch(DatabaseException de) {
                                                //Log it.
                                            }
                                            
                                                </pre>saveAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
It adds a record to any single table in a relational database asynchronous.
    <pre>
                                            Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(beer_link));
                                            
                                            
                                            - Using Transaction
                                            
                                                var callback = new Callback();
                                                callback.onExecute = function(transaction) {
                                            
                                                    var saveCallback = new Callback();
                                                    saveCallback.onSuccess = function() {
                                            
                                                    }
                                            
                                                    cBook.saveAsync(saveCallback, transaction);
                                                }
                                            
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                            
                                                try {
                                            
                                                    var databaseDescriptor = new Book().getDatabaseDescriptor();
                                                    Database.beginTransactionAsync(databaseDescriptor, callback);
                                                } catch(e) {
                                                    //Log it.
                                                }
                                            
                                            - Using Callback
                                            
                                                var callback = new Callback();
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                                try {
                                                    cBook.saveAsync(callback);
                                                } catch(e) {
                                                    //Log it.
                                                }
                                            
                                                </pre>Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
saveOrUpdate
                                            
                                                    ()
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                It finds out whether tuple exists in table or not. IF NOT EXISTS: adds a record to any single table in a relational database. ELSE: updates a record to any single table in a relational database.
Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(c_link));
                                            
                                            try {
                                                cBook.saveOrUpdate();
                                            } catch(DatabaseException de) {
                                                //Log it.
                                            }saveOrUpdateAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
It finds out whether tuple exists in table or not. IF NOT EXISTS: adds a record to any single table in a relational database. ELSE: updates a record to any single table in a relational database.
Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(c_link));
                                            
                                            
                                            - Using Transaction
                                            
                                                var callback = new Callback();
                                                callback.onExecute = function(transaction) {
                                            
                                                    var saveOrUpdateCallback = new Callback();
                                                    saveOrUpdateCallback.onSuccess = function() {
                                            
                                                    }
                                            
                                                    cBook.saveOrUpdateAsync(saveOrUpdateCallback, transaction);
                                                }
                                            
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                            
                                                try {
                                            
                                                    var databaseDescriptor = new Book().getDatabaseDescriptor();
                                                    Database.beginTransactionAsync(databaseDescriptor, callback);
                                                } catch(e) {
                                                    //Log it.
                                                }
                                            
                                            - Using Callback
                                            
                                                var callback = new Callback();
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                                try {
                                                    cBook.saveOrUpdateAsync(callback);
                                                } catch(e) {
                                                    //Log it.
                                                }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
select
                                            
                                                    ()
                                            
                                                    
                                                        ISelect
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Fetch tuples from table.
    Example:
                                            
                                                var books =  new Book().select()
                                                                .where(Book.TITLE).equalTo("C")
                                                                .and(Book.AUTHOR).equalTo("C Author")
                                                                .execute();Returns:
ISelect to provide extra information based on which tuples will be fetched from table.
sum
                                            
                                                    ()
                                            
                                                    
                                                        ISum
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the sum based on column name provided.
    Example:
                                                    var sum = 0;
                                                    
                                                    try {
                                                        sum = new Book().sum()
                                                                    .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
ISum to provide extra information based on which sum will be calculated.
total
                                            
                                                    ()
                                            
                                                    
                                                        ITotal
                                                    
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                Returns the total based on column name provided.
    Example:
                                                    var total = 0;
                                                    
                                                    try {
                                                        total = new Book().total()
                                                                    .column(Book.COLUMN_NAME_WHICH_CONTAIN_NUMBRIC_VALUE)
                                                                    .where(Book.TITLE).equalTo("C")
                                                                    .execute();
                                                        
                                                    } catch(DatabaseException de) {
                                                        //Log it.
                                                    }Returns:
ITotal to provide extra information based on which total will be calculated.
update
                                            
                                                    ()
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                
                                            
                                                It updates a record to any single table in a relational database.
Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(c_link));
                                            
                                            try {
                                                cBook.update();
                                            } catch(DatabaseException de) {
                                                //Log it.
                                            }updateAsync
                                            
                                                    - 
                                                                    callback
- 
                                                                    transaction
It updates asynchronous a record to any single table in a relational database.
Example: Make Book Object
var cBook = new Book();
                                            cBook.setTitle(Book.BOOK_TYPE_C);
                                            cBook.setDescription(c_description));
                                            cBook.setAuthor(c_author));
                                            cBook.setLink(c_link));
                                            
                                            
                                            - Using Transaction
                                            
                                                var callback = new Callback();
                                                callback.onExecute = function(transaction) {
                                            
                                                    var updateCallback = new Callback();
                                                    updateCallback.onSuccess = function() {
                                            
                                                    }
                                            
                                                    cBook.updateAsync(updateCallback, transaction);
                                                }
                                            
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                            
                                                try {
                                            
                                                    var databaseDescriptor = new Book().getDatabaseDescriptor();
                                                    Database.beginTransactionAsync(databaseDescriptor, callback);
                                                } catch(e) {
                                                    //Log it.
                                                }
                                            
                                            - Using Callback
                                            
                                                var callback = new Callback();
                                                callback.onSuccess = function() {
                                            
                                                }
                                            
                                                callback.onFailure = function() {
                                            
                                                }
                                            
                                                try {
                                                    cBook.updateAsync(callback);
                                                } catch(e) {
                                                    //Log it.
                                                }Parameters:
- 
                                                                    callbackCallbackRequest Callback 
- 
                                                                    transactionTransactionRequest Transaction 
 Siminov Hybrid
            Siminov Hybrid