public void statementStarted(SqlJetDb db) throws SqlJetException { this.db.getDb().getTemporaryDatabase().beginTransaction(SqlJetTransactionMode.WRITE); }
public void statementStarted(SqlJetDb db) throws SqlJetException { this.db.getDb().getTemporaryDatabase().beginTransaction(SqlJetTransactionMode.WRITE); }
public void statementStarted(SqlJetDb db) throws SqlJetException { this.db.getDb().getTemporaryDatabase().beginTransaction(SqlJetTransactionMode.WRITE); }
public void statementStarted(SqlJetDb db) throws SqlJetException { this.db.getDb().getTemporaryDatabase().beginTransaction(SqlJetTransactionMode.WRITE); }
private <T> T execute(Query<T> query, DB db) throws SqlJetException { Pool<SqlJetDb, SqlJetException> pool = this.pools.get(db); Lock lock = this.locks.get(db).readLock(); SqlJetDb database = pool.take(); lock.lock(); try { database.beginTransaction(SqlJetTransactionMode.READ_ONLY); try { return query.execute(database); } finally { database.commit(); } } finally { lock.unlock(); pool.release(database); } }
private void createStructure(SqlJetDb db) throws SqlJetException { db.beginTransaction(SqlJetTransactionMode.WRITE); try { db.createTable("CREATE TABLE states (full_name TEXT NOT NULL PRIMARY KEY, version TEXT NULL)"); db.createIndex("CREATE INDEX full_name_index ON states(full_name)"); } finally { db.commit(); } }
database.beginTransaction(SqlJetTransactionMode.WRITE);
@Override public void insert(State state) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); table.insert(getData(state)); } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to insert: " + state, e); } }
private static Map<SvnChecksum, Integer> calculateCorrectChecksumRefcounts(SVNWCDbRoot root) throws SVNException { Map<SvnChecksum, Integer> checksumToRefCount = new HashMap<SvnChecksum, Integer>(); final SqlJetDb db = root.getSDb().getDb(); try { final ISqlJetTable nodesTable = db.getTable(SVNWCDbSchema.NODES.name()); db.beginTransaction(SqlJetTransactionMode.READ_ONLY); final ISqlJetCursor cursor = nodesTable.open(); for (; !cursor.eof(); cursor.next()) { String sha1ChecksumString = cursor.getString(SVNWCDbSchema.NODES__Fields.checksum.name()); if (sha1ChecksumString == null) { continue; } SvnChecksum sha1Checksum = SvnChecksum.fromString(sha1ChecksumString); Integer refCount = checksumToRefCount.get(sha1Checksum); int incrementedRefCount = refCount == null ? 1 : refCount + 1; checksumToRefCount.put(sha1Checksum, incrementedRefCount); } cursor.close(); } catch (SqlJetException e) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.WC_DB_ERROR, e); SVNErrorManager.error(errorMessage, e, SVNLogType.WC); } finally { try { db.commit(); } catch (SqlJetException ignore) { } } return checksumToRefCount; }
@Override public void delete(String fullname) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); ISqlJetCursor cursor = table.lookup(StateTable.NDX_FULL_NAME, fullname); while (!cursor.eof()) { cursor.delete(); } cursor.close(); } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to delete: " + fullname, e); } }
@Override public State get(String fullname) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); ISqlJetCursor cursor = table.lookup(StateTable.NDX_FULL_NAME, fullname); if (!cursor.eof()) { State state = read(cursor); cursor.close(); return state; } } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to get " + fullname, e); } return null; }
public void beginTransaction(SqlJetTransactionMode mode) throws SVNException { if (mode != null) { openCount++; if (isLogTransactions()) { logCall("Being transaction request (" + openCount + "): " + mode, 5); } if (isNeedStartTransaction(mode)) { try { db.beginTransaction(mode); if (isLogTransactions()) { SVNDebugLog.getDefaultLog().logFine(SVNLogType.DEFAULT, "transaction started"); } } catch (SqlJetException e) { createSqlJetError(e); } } } else { SVNErrorManager.assertionFailure(mode != null, "transaction mode is null", SVNLogType.WC); } }
@Override public void update(State state) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); ISqlJetCursor cursor = table.lookup(StateTable.NDX_FULL_NAME, state.fullname); while (!cursor.eof()) { cursor.update(getData(state)); cursor.next(); } cursor.close(); } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to update: " + state, e); } }
sqljetDb.beginTransaction(SqlJetTransactionMode.READ_ONLY); ISqlJetTable nodesTable = sqljetDb.getTable(SVNWCDbSchema.NODES.toString()); String parentRelPath = null;
private static Map<SvnChecksum, Integer> loadChecksumsRefcountsFromTable(SVNWCDbRoot root) throws SVNException { Map<SvnChecksum, Integer> checksumToRefCount = new HashMap<SvnChecksum, Integer>(); final SqlJetDb db = root.getSDb().getDb(); try { final ISqlJetTable pristineTable = db.getTable(SVNWCDbSchema.PRISTINE.name()); db.beginTransaction(SqlJetTransactionMode.READ_ONLY); final ISqlJetCursor cursor = pristineTable.open(); for (; !cursor.eof(); cursor.next()) { String sha1ChecksumString = cursor.getString(PRISTINE__Fields.checksum.name()); if (sha1ChecksumString == null) { continue; } SvnChecksum sha1Checksum = SvnChecksum.fromString(sha1ChecksumString); long refcount = cursor.getInteger(PRISTINE__Fields.refcount.name()); checksumToRefCount.put(sha1Checksum, (int)refcount); } cursor.close(); } catch (SqlJetException e) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.WC_DB_ERROR, e); SVNErrorManager.error(errorMessage, e, SVNLogType.WC); } finally { try { db.commit(); } catch (SqlJetException ignore) { } } return checksumToRefCount; }
sqljetDb.beginTransaction(SqlJetTransactionMode.READ_ONLY); ISqlJetTable nodesTable = sqljetDb.getTable(SVNWCDbSchema.NODES.toString()); cursor = nodesTable.scope(null, new Object[] {wcId, localRelPathStr}, null);
boolean matched = false; try { sqljetDb.beginTransaction(SqlJetTransactionMode.READ_ONLY); ISqlJetTable nodesTable = sqljetDb.getTable(SVNWCDbSchema.NODES.toString()); cursor = nodesTable.scope(null, new Object[] {wcId, localRelPathStr}, null);