if ("auto_vacuum".equals(name)) { int mode = readAutovacuumMode(value); getOptions().setAutovacuum(mode == 1); getOptions().setIncrementalVacuum(mode == 2); } else if ("cache_size".equals(name)) { if (value instanceof Number) { getOptions().setCacheSize(((Number) value).intValue()); } else { throw new SqlJetException(SqlJetErrorCode.ERROR, "Invalid cache_size value: " + value); SqlJetEncoding enc = SqlJetEncoding.decode((String) value); if (enc != null) { getOptions().setEncoding(enc); } else { throw new SqlJetException(SqlJetErrorCode.ERROR, "Unknown encoding: " + value); getOptions().setLegacyFileFormat(toBooleanValue(value)); } else if ("schema_version".equals(name)) { if (value instanceof Number) { int version = ((Number) value).intValue(); getOptions().setSchemaVersion(version); } else { throw new SqlJetException(SqlJetErrorCode.ERROR, "Invalid schema_version value: " + value); if (value instanceof Number) { int version = ((Number) value).intValue(); getOptions().setUserVersion(version); } else { throw new SqlJetException(SqlJetErrorCode.ERROR, "Invalid user_version value: " + value);
private void dropIndexSafe(String indexName) throws SqlJetException { if (null == indexName || "".equals(indexName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "Index name must be not empty"); if (!indexDefs.containsKey(indexName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "Index not found: " + indexName); if (doDropIndex(indexName, false, true)) { db.getOptions().changeSchemaVersion(); indexDefs.remove(indexName); } }
/** * {@inheritDoc} * @see net.sf.hajdbc.pool.PoolProvider#create() */ @Override public synchronized SqlJetDb create() throws SqlJetException { boolean exists = this.file.exists(); SqlJetDb db = SqlJetDb.open(this.file, true); if (!exists) { db.getOptions().setAutovacuum(true); db.getOptions().setIncrementalVacuum(true); } return db; }
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; } });
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; }
public SVNWCDbRoot(SVNWCDb db, File absPath, SVNSqlJetDb sDb, long wcId, int format, boolean autoUpgrade, boolean failOnVersionsMismatch, boolean enforceEmptyWQ) throws SVNException { if (sDb != null) { try { format = sDb.getDb().getOptions().getUserVersion(); } catch (SqlJetException e) { if (e.getErrorCode() == SqlJetErrorCode.NOTADB) {
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; } });
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; } });
childItem.opRoot = opDepth == SVNWCUtils.relpathDepth(childRelPath); childItem.format = db.getDb().getOptions().getUserVersion(); nodes.put(name, childItem);
db.getOptions().setUserVersion(userVersion);
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; } });
private void dropTriggerSafe(String triggerName) throws SqlJetException { if (null == triggerName || "".equals(triggerName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "Trigger name must be not empty"); if (!triggerDefs.containsKey(triggerName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "Trigger not found: " + triggerName); final SqlJetTriggerDef triggerDef = (SqlJetTriggerDef) triggerDefs.get(triggerName); final ISqlJetBtreeSchemaTable schemaTable = openSchemaTable(true); try { schemaTable.lock(); try { db.getOptions().changeSchemaVersion(); if (!schemaTable.goToRow(triggerDef.getRowId()) || !TRIGGER_TYPE.equals(schemaTable.getTypeField())) throw new SqlJetException(SqlJetErrorCode.CORRUPT); final String n = schemaTable.getNameField(); if (null == n || !triggerName.equals(n)) throw new SqlJetException(SqlJetErrorCode.CORRUPT); schemaTable.delete(); } finally { schemaTable.unlock(); } } finally { schemaTable.close(); } triggerDefs.remove(triggerName); }
private void dropViewSafe(String viewName) throws SqlJetException { if (null == viewName || "".equals(viewName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "View name must be not empty"); if (!viewDefs.containsKey(viewName)) throw new SqlJetException(SqlJetErrorCode.MISUSE, "View not found: " + viewName); final SqlJetViewDef viewDef = (SqlJetViewDef) viewDefs.get(viewName); final ISqlJetBtreeSchemaTable schemaTable = openSchemaTable(true); try { schemaTable.lock(); try { db.getOptions().changeSchemaVersion(); if (!schemaTable.goToRow(viewDef.getRowId()) || !VIEW_TYPE.equals(schemaTable.getTypeField())) throw new SqlJetException(SqlJetErrorCode.CORRUPT); final String n = schemaTable.getNameField(); if (null == n || !viewName.equals(n)) throw new SqlJetException(SqlJetErrorCode.CORRUPT); schemaTable.delete(); } finally { schemaTable.unlock(); } } finally { schemaTable.close(); } viewDefs.remove(viewName); }
schemaTable.lock(); try { db.getOptions().changeSchemaVersion();
schemaTable.lock(); try { db.getOptions().changeSchemaVersion();
db.getOptions().changeSchemaVersion();
db.getOptions().changeSchemaVersion();
db.getOptions().changeSchemaVersion();
db.getOptions().changeSchemaVersion();
db.getOptions().changeSchemaVersion();