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 SqlJetScope reverse() { SqlJetScopeBound rightBound = getRightBound() != null ? new SqlJetScopeBound(getRightBound().getValue(), getRightBound().isInclusive()) : null; SqlJetScopeBound leftBound = getLeftBound() != null ? new SqlJetScopeBound(getLeftBound().getValue(), getLeftBound().isInclusive()) : null; return new SqlJetScope(rightBound, leftBound); }
public SqlJetValueType getFieldType(final String fieldName) throws SqlJetException { return (SqlJetValueType) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return getBtreeDataTable().getFieldType(getFieldSafe(fieldName)); } }); }
public String getText(int columnIndex) throws SqlJetException { if (result instanceof String && columnIndex == 0) { return (String) result; } return cursor.getString(columnIndex); }
public void close() throws SqlJetException { if (table != null) { table = null; } if (cursor != null) { cursor.close(); cursor = null; } }
public ISqlJetCursor open() throws SqlJetException { return (ISqlJetCursor) db.runWithLock(new ISqlJetRunnableWithLock() { public Object runWithLock(SqlJetDb db) throws SqlJetException { return new SqlJetTableDataCursor(new SqlJetBtreeDataTable(btree, tableName, write), db); } }); }
public SqlJetValueType getColumnType(int columnIndex) throws SqlJetException { if (result instanceof String) { return SqlJetValueType.TEXT; } if (result instanceof Integer) { return SqlJetValueType.INTEGER; } if (result instanceof Double) { return SqlJetValueType.FLOAT; } return cursor.getFieldType(columnIndex); }
public byte[] getBlobAsArray(final String fieldName) throws SqlJetException { return (byte[]) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { ISqlJetMemoryPointer buffer = getBtreeDataTable().getBlob(getFieldSafe(fieldName)); return buffer != null ? SqlJetUtility.readByteBuffer(buffer) : null; } }); }
public Object getValue(final String fieldName) throws SqlJetException { return db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { if (SqlJetBtreeDataTable.isFieldNameRowId(fieldName)) { return getBtreeDataTable().getRowId(); } else { return getBtreeDataTable().getValue(getFieldSafe(fieldName)); } } }); }
public int getFieldsCount() throws SqlJetException { return (Integer) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return btreeTable.getFieldsCount(); } }); }
public long getInteger(final int field) throws SqlJetException { return (Long) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return btreeTable.getInteger(field); } }); }
public String getString(final String fieldName) throws SqlJetException { return (String) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return getBtreeDataTable().getString(getFieldSafe(fieldName)); } }); }
public SqlJetValueType getFieldType(final int field) throws SqlJetException { return (SqlJetValueType) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return btreeTable.getFieldType(field); } }); }
public boolean getBoolean(final int field) throws SqlJetException { return (Boolean) db.runReadTransaction(new ISqlJetTransaction() { public Object run(SqlJetDb db) throws SqlJetException { return btreeTable.getInteger(field) != 0; } }); }