Examples of runWriteTransaction()


Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

        deflate(new File(DB_ARCHIVE), DB_FILE_NAME, dbFile1, true);

        final SqlJetDb db1 = SqlJetDb.open(dbFile1, false);
        final SqlJetDb db2 = SqlJetDb.open(dbFile2, true);

        db2.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                db.createTable("create table rep_cache (hash text not null primary key, "
                        + "                        revision integer not null, "
                        + "                        offset integer not null, "
                        + "                        size integer not null, "
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

                        for (int i = 0; i < c.getFieldsCount(); i++) {
                            values.add(c.getValue(i));
                        }
                        long rev = c.getInteger(1);
                        if (rev != currentRev) {
                            db2.runWriteTransaction(new ISqlJetTransaction() {
                                public Object run(SqlJetDb db) throws SqlJetException {
                                    for (Collection<Object> row : block) {
                                        db2.getTable("rep_cache").insert(row.toArray());
                                    }
                                    return null;
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

                        }
                        block.add(new ArrayList<Object>(values));
                        c.next();
                    }
                    if (!block.isEmpty()) {
                        db2.runWriteTransaction(new ISqlJetTransaction() {
                            public Object run(SqlJetDb db) throws SqlJetException {
                                for (Collection<Object> row : block) {
                                    db2.getTable("rep_cache").insert(row.toArray());
                                }
                                return null;
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

    }

    @Test
    public void createIndexRepCache() throws SqlJetException, FileNotFoundException, IOException {
        final SqlJetDb repCache = SqlJetDb.open(copyFile(new File(REP_CACHE_DB), DELETE_COPY), true);
        repCache.runWriteTransaction(new ISqlJetTransaction() {

            public Object run(SqlJetDb db) throws SqlJetException {
                db.createIndex("CREATE INDEX rep_cache_test_index ON " + REP_CACHE_TABLE
                        + "(hash, revision, offset, size, expanded_size);");
                final ISqlJetTable openTable = repCache.getTable(REP_CACHE_TABLE);
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

    }

    @Test
    public void createTableRepCache() throws SqlJetException, FileNotFoundException, IOException {
        final SqlJetDb repCache = SqlJetDb.open(copyFile(new File(REP_CACHE_DB), DELETE_COPY), true);
        repCache.runWriteTransaction(new ISqlJetTransaction() {

            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text )");
                final ISqlJetTable openTable = repCache.getTable(createTable.getName());
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

    }

    @Test
    public void dropTableRepCache() throws SqlJetException, FileNotFoundException, IOException {
        final SqlJetDb repCache = SqlJetDb.open(copyFile(new File(REP_CACHE_DB), DELETE_COPY), true);
        repCache.runWriteTransaction(new ISqlJetTransaction() {

            public Object run(SqlJetDb db) throws SqlJetException {
                db.dropTable(REP_CACHE_TABLE);
                return null;
            }
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

        final File createFile = File.createTempFile(SCHEMA_TEST, null);
        if (DELETE_COPY)
            createFile.deleteOnExit();

        final SqlJetDb createDb = SqlJetDb.open(createFile, true);
        createDb.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text )");
                logger.info(createTable.toString());
                db.createIndex("CREATE INDEX test_index ON test(name);");
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

        if (DELETE_COPY)
            createFile.deleteOnExit();

        final SqlJetDb createDb = SqlJetDb.open(createFile, true);
        createDb.getOptions().setEncoding(SqlJetEncoding.UTF16LE);
        createDb.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text )");
                logger.info(createTable.toString());
                db.createIndex("CREATE INDEX test_index ON test(name);");
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

        final File createFile = File.createTempFile(SCHEMA_TEST, null);
        if (DELETE_COPY)
            createFile.deleteOnExit();

        final SqlJetDb createDb = SqlJetDb.open(createFile, true);
        createDb.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                createDb.getOptions().setCacheSize(1000);
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text )");
                logger.info(createTable.toString());
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.SqlJetDb.runWriteTransaction()

            createFile.deleteOnExit();

        final SqlJetDb createDb = SqlJetDb.open(createFile, true);
        createDb.getOptions().setAutovacuum(true);
        createDb.getOptions().setIncrementalVacuum(true);
        createDb.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {

                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text )");
                logger.info(createTable.toString());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.