Codota Logo
SqlJetDb.runWriteTransaction
Code IndexAdd Codota to your IDE (free)

How to use
runWriteTransaction
method
in
org.tmatesoft.sqljet.core.table.SqlJetDb

Best Java code snippets using org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction (Showing top 20 results out of 315)

  • Common ways to obtain SqlJetDb
private void myMethod () {
SqlJetDb s =
  • Codota IconFile file;SqlJetDb.open(file, true)
  • Codota IconFSFS fSFS;SqlJetDb.open(fSFS.getRepositoryCacheFile(), true)
  • Smart code suggestions by Codota
}
origin: org.tmatesoft.sqljet/sqljet

private Object runWriteTransaction(final ISqlJetTableRun op) throws SqlJetException {
  return db.runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      final ISqlJetBtreeDataTable table = new SqlJetBtreeDataTable(btree, tableName, write);
      try {
        return op.run(table);
      } finally {
        table.close();
      }
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public long updateWithRowIdOr(final SqlJetConflictAction onConflict, final long rowId, final Object... values)
    throws SqlJetException {
  return (Long) db.runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      final ISqlJetBtreeDataTable table = getBtreeDataTable();
      if (table.eof()) {
        throw new SqlJetException(SqlJetErrorCode.MISUSE,
            "Table is empty or current record doesn't't point to data row");
      }
      return table.updateCurrentWithRowId(onConflict, rowId, values);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public void updateOr(final SqlJetConflictAction onConflict, final Object... values) throws SqlJetException {
  db.runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      final ISqlJetBtreeDataTable table = getBtreeDataTable();
      if (table.eof()) {
        throw new SqlJetException(SqlJetErrorCode.MISUSE,
            "Table is empty or current record doesn't't point to data row");
      }
      table.updateCurrent(onConflict, values);
      return null;
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public void updateByFieldNamesOr(final SqlJetConflictAction onConflict, final Map<String, Object> values)
    throws SqlJetException {
  db.runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      final ISqlJetBtreeDataTable table = getBtreeDataTable();
      if (table.eof()) {
        throw new SqlJetException(SqlJetErrorCode.MISUSE,
            "Table is empty or current record doesn't point to data row");
      }
      table.update(onConflict, values);
      return null;
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Creates trigger from SQL clause.
 * 
 * @param sql
 *            CREATE TRIGGER ... sentence.
 * @return definition of the trigger being created.
 */
public ISqlJetTriggerDef createTrigger(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetTriggerDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().createTrigger(sql);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Drop table.
 * 
 * @param tableName name of table to drop.
 */
public void dropTable(final String tableName) throws SqlJetException {
  checkOpen();
  runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      getSchemaInternal().dropTable(tableName);
      return null;
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Drop index.
 * 
 * @param indexName name of the index to drop.
 */
public void dropIndex(final String indexName) throws SqlJetException {
  checkOpen();
  runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      getSchemaInternal().dropIndex(indexName);
      return null;
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Drop view.
 * 
 * @param viewName name of the view to drop.
 */
public void dropView(final String viewName) throws SqlJetException {
  checkOpen();
  runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      getSchemaInternal().dropView(viewName);
      return null;
    }
  });
}

origin: org.tmatesoft.sqljet/sqljet

/**
 * Create index from SQL clause.
 * 
 * @param sql
 *            CREATE INDEX ... sentence.
 * @return definition of created index.
 */
public ISqlJetIndexDef createIndex(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetIndexDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().createIndex(sql);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Creates virtual table from SQL clause.
 * 
 * @param sql
 *            CREATE VIRTUAL TABLE ... sentence.
 * @return definition of create virtual table.
 */
public ISqlJetVirtualTableDef createVirtualTable(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetVirtualTableDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().createVirtualTable(sql, 0);
    }
  });
}

origin: org.tmatesoft.sqljet/sqljet

/**
 * Drop trigger.
 * 
 * @param triggerName name of the trigger to drop.
 */
public void dropTrigger(final String triggerName) throws SqlJetException {
  checkOpen();
  runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      getSchemaInternal().dropTrigger(triggerName);
      return null;
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public void delete() throws SqlJetException {
  db.runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      final ISqlJetBtreeDataTable table = getBtreeDataTable();
      if (table.eof()) {
        throw new SqlJetException(SqlJetErrorCode.MISUSE,
            "Table is empty or current record doesn't point to data row");
      }
      table.delete();
      return null;
    }
  });
  super.delete();
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Alters table.
 * 
 * @param sql
 *            ALTER TABLE ... sentence.
 * @return altered table schema definition.
 */
public ISqlJetTableDef alterTable(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetTableDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().alterTable(sql);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Creates view from SQL clause.
 * 
 * @param sql
 *            CREATE VIEW X AS SELECT ... sentence.
 * @return definition of the view being created.
 */
public ISqlJetViewDef createView(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetViewDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().createView(sql);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Create table from SQL clause.
 * 
 * @param sql
 *            CREATE TABLE ... sentence.
 * @return definition of create table.
 */
public ISqlJetTableDef createTable(final String sql) throws SqlJetException {
  checkOpen();
  return (ISqlJetTableDef) runWriteTransaction(new ISqlJetTransaction() {
    public Object run(SqlJetDb db) throws SqlJetException {
      return getSchemaInternal().createTable(sql);
    }
  });
}
origin: org.jvnet.hudson.svnkit/svnkit

public void runWriteTransaction(final IFSSqlJetTransaction transaction) throws SVNException {
  if (myRepCacheDB != null) {
    try {
      myRepCacheDB.runWriteTransaction(new ISqlJetTransaction() {
        public Object run(SqlJetDb db) throws SqlJetException {
          try {
            transaction.run();
          } catch (SVNException e) {
            throw new SqlJetException(e);
          }
          return null;
        }
      });
    } catch (SqlJetException e) {
      SVNErrorManager.error(convertError(e), SVNLogType.FSFS);
    }
  }
}
origin: org.tmatesoft.svnkit/svnkit

  public Object runWithLock(SqlJetDb db) throws SqlJetException {
    int version = db.getOptions().getUserVersion();
    if (version < REP_CACHE_DB_FORMAT) {
      db.getOptions().setAutovacuum(true);
      db.runWriteTransaction(new ISqlJetTransaction() {
        public Object run(SqlJetDb db) throws SqlJetException {
          db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
          db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
          return null;
        }
      });
    } else if (version > REP_CACHE_DB_FORMAT) {
      throw new SqlJetException("Schema format " + version + " not recognized");   
    }
    return null;
  }
});
origin: org.jvnet.hudson.svnkit/svnkit

  public Object runWithLock(SqlJetDb db) throws SqlJetException {
    int version = db.getOptions().getUserVersion();
    if (version < REP_CACHE_DB_FORMAT) {
      db.getOptions().setAutovacuum(true);
      db.runWriteTransaction(new ISqlJetTransaction() {
        public Object run(SqlJetDb db) throws SqlJetException {
          db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
          db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
          return null;
        }
      });
    } else if (version > REP_CACHE_DB_FORMAT) {
      throw new SqlJetException("Schema format " + version + " not recognized");   
    }
    return null;
  }
});
origin: com.svnkit/com.springsource.org.tigris.subversion.javahl

  public Object runWithLock(SqlJetDb db) throws SqlJetException {
    int version = db.getOptions().getUserVersion();
    if (version < REP_CACHE_DB_FORMAT) {
      db.getOptions().setAutovacuum(true);
      db.runWriteTransaction(new ISqlJetTransaction() {
        public Object run(SqlJetDb db) throws SqlJetException {
          db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
          db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
          return null;
        }
      });
    } else if (version > REP_CACHE_DB_FORMAT) {
      throw new SqlJetException("Schema format " + version + " not recognized");   
    }
    return null;
  }
});
origin: org.tmatesoft.svnkit/svnkit

public long exec() throws SVNException {
  try {
    sDb.getDb().getOptions().setAutovacuum(true);
    sDb.getDb().runWriteTransaction(new ISqlJetTransaction() {
      public Object run(SqlJetDb db) throws SqlJetException {
        db.createTable("create table revprop (revision integer UNIQUE not null, " +
            "properties BLOB not null);");
        db.createIndex("create index i_revision on revprop (revision);");
        db.getOptions().setUserVersion(1);
        return null;
      }
    });
  } catch (SqlJetException e) {
    SVNErrorMessage err = SVNErrorMessage.create( SVNErrorCode.SQLITE_ERROR,e);
    SVNErrorManager.error(err, SVNLogType.FSFS);
  }
  return 0;
}
org.tmatesoft.sqljet.core.tableSqlJetDbrunWriteTransaction

Javadoc

Run modifications in write transaction.

Popular methods of SqlJetDb

  • getTable
    Open table.
  • open
  • close
  • getOptions
  • createIndex
    Create index from SQL clause.
  • createTable
    Create table from SQL clause.
  • runWithLock
    Do some actions with locking database's internal threads synchronization mutex. It is related only w
  • beginTransaction
  • commit
  • getSchema
    Get database schema.
  • runReadTransaction
    Run read-only transaction.
  • dropIndex
    Drop index.
  • runReadTransaction,
  • dropIndex,
  • dropTable,
  • getTemporaryDatabase,
  • isInTransaction,
  • isOpen,
  • rollback,
  • <init>,
  • alterTable

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • addToBackStack (FragmentTransaction)
  • String (java.lang)
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now