apps/communications/dialer/js/call_log_db.js
/**
   * Start a new database transaction.
   *
   * param txnType
   *        Type of transaction (e.g. 'readwrite').
   * param callback
   *        Function to call when the transaction is available. It will be
   *        invoked with the transaction and the requested object stores.
   * param objectStores
   *        The names of object stores and indexes that are in the scope of the
   *        new transaction as an array of strings. Specify only the object
   *        stores that you need to access. If you need to access only one
   *        object store, you can specify its name as a string.
   */
Start a new database transaction.
param txnType
Type of transaction .
param callback
Function to call when the transaction is available. It will be
invoked with the transaction and the requested object stores.
param objectStores
The names of object stores and indexes that are in the scope of the
new transaction as an array of strings. Specify only the object
stores that you need to access. If you need to access only one
object store, you can specify its name as a string.
Start a new database transaction . param txnType Type of transaction . param callback Function to call when the transaction is available . It will be invoked with the transaction and the requested object stores . param objectStores The names of object stores and indexes that are in the scope of the new transaction as an array of strings . Specify only the object stores that you need to access . If you need to access only one object store you can specify its name as a string .
function newTxn(txnType, objectStores, callback) {
    if (!objectStores) {
      objectStores = [this._dbGroupsStore];
    }
    if (!Array.isArray(objectStores)) {
      objectStores = [objectStores];
    }
    this._ensureDB(function(error, db) {
      if (error) {
        callback(error);
        return;
      }
      var txn = db.transaction(objectStores, txnType);
      var stores;
      if (objectStores.length === 1) {
        stores = txn.objectStore(objectStores[0]);
      } else {
        stores = [];
        for (var i = 0; i < objectStores.length; i++) {
          stores.push(txn.objectStore(objectStores[i]));
        }
      }
      callback(null, txn, stores);
    });
  }
function newTxn ( txnType , objectStores , callback ) { if ( ! objectStores ) { objectStores = [ this . _dbGroupsStore ] ; } if ( ! Array . isArray ( objectStores ) ) { objectStores = [ objectStores ] ; } this . _ensureDB ( function ( error , db ) { if ( error ) { callback ( error ) ; return ; } var txn = db . transaction ( objectStores , txnType ) ; var stores ; if ( objectStores . length === 1 ) { stores = txn . objectStore ( objectStores [ 0 ] ) ; } else { stores = [ ] ; for ( var i = 0 ; i < objectStores . length ; i ++ ) { stores . push ( txn . objectStore ( objectStores [ i ] ) ) ; } } callback ( null , txn , stores ) ; } ) ; }
Start a new database transaction.
Start a new database transaction .