Package org.tmatesoft.sqljet.core.table

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTransaction


        for (ISqlJetColumnDef column : tableDef.getColumns()) {
            names.add(column.getName());
        }
        final String[] namesArray = (String[]) names.toArray(new String[names.size()]);

        table.getDataBase().runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                ISqlJetCursor cursor = table.open();// order(table.getPrimaryKeyIndexName());
                try {
                    for (long i = 0; i < fromID && !cursor.eof(); i++) {
                        cursor.next();
View Full Code Here


        // create database, table and two indices:
        SqlJetDb db = SqlJetDb.open(dbFile, true);
        // set DB option that have to be set before running any transactions:
        db.getOptions().setAutovacuum(true);
        // set DB option that have to be set in a transaction:
        db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                db.getOptions().setUserVersion(1);
                return true;
            }
        }, SqlJetTransactionMode.WRITE);
View Full Code Here

    protected ISqlJetBtreeDataTable getBtreeDataTable() {
        return (ISqlJetBtreeDataTable) btreeTable;
    }

    public long getRowId() throws SqlJetException {
        return (Long) db.runReadTransaction(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 the current record doesn't point to a data row");
View Full Code Here

            }
        });
    }

    public boolean goTo(final long rowId) throws SqlJetException {
        return (Boolean) db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetBtreeDataTable table = getBtreeDataTable();
                return table.goToRow(rowId);
            }
        });
View Full Code Here

        }
        return field;
    }

    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));
            }
        });
    }
View Full Code Here

            }
        });
    }

    public boolean isNull(final String fieldName) throws SqlJetException {
        return (Boolean) db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                return getBtreeDataTable().isNull(getFieldSafe(fieldName));
            }
        });
    }
View Full Code Here

            }
        });
    }

    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));
            }
        });
    }
View Full Code Here

            }
        });
    }

    public long getInteger(final String fieldName) throws SqlJetException {
        return (Long) db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                if (SqlJetBtreeDataTable.isFieldNameRowId(fieldName)) {
                    return getBtreeDataTable().getRowId();
                } else {
                    return getBtreeDataTable().getInteger(getFieldSafe(fieldName));
View Full Code Here

            }
        });
    }

    public double getFloat(final String fieldName) throws SqlJetException {
        return (Double) db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                return getBtreeDataTable().getFloat(getFieldSafe(fieldName));
            }
        });
    }
View Full Code Here

            }
        });
    }

    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;
            }
        });
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.table.ISqlJetTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.