Package org.tmatesoft.sqljet.core.table

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


        db.createTable(TABLE_DDL);
        db.createIndex(INDEX_DDL);
        db.commit();

        SecureRandom rnd = new SecureRandom();
        ISqlJetTable table = db.getTable("tiles");
        for (int i = 0; i < INSERTS_COUNT; i++) {
            byte[] blob = new byte[1024 + rnd.nextInt(4096)];
            rnd.nextBytes(blob);

            int x = rnd.nextInt(2048);
            int y = 0;
            int zoom = 10;
            db.beginTransaction(SqlJetTransactionMode.WRITE);
            try {
                table.insert(x, y, zoom, 0, blob);
            } catch (SqlJetException e) {
                if (SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
                    // insert failed because record already exists -> update
                    // it

                    Object[] key = new Object[] { x, y, zoom, 0 };
                    ISqlJetCursor updateCursor = table.lookup("IND", key);
                    do {
                        updateCursor.update(x, y, zoom, 0, blob);
                    } while (updateCursor.next());
                    updateCursor.close();
View Full Code Here


        db.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 = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert(null, "test");
                return null;
            }
        });
    }
View Full Code Here

        db.runWriteTransaction(new ISqlJetTransaction() {

            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text unique )");
                final ISqlJetTable openTable = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert(null, "test");
                return null;
            }
        });
    }
View Full Code Here

        db.runWriteTransaction(new ISqlJetTransaction() {

            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetTableDef createTable = db
                        .createTable("create table test( id integer primary key, name text unique )");
                final ISqlJetTable openTable = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert("test");
                openTable.insert("test");
                return null;
            }
        });
        Assert.assertFalse(false);
    }
View Full Code Here

        db.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 = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert(null, "test");
                db.createIndex("CREATE INDEX test_name_index ON test(name);");
                return null;
            }
        });
    }
View Full Code Here

        db.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 = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert("test");
                db.createIndex("CREATE INDEX test_name_index ON test(test);");
                return null;
            }
        });
        Assert.assertFalse(false);
View Full Code Here

        db.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 = db.getTable(createTable.getName());
                logger.info(createTable.toString());
                openTable.insert("test");
                db.createIndex("CREATE INDEX test_name_index ON test(name);");
                db.createIndex("CREATE INDEX test_name_index ON test(name);");
                return null;
            }
        });
View Full Code Here

        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);
                openTable.insert("test", 1, 2, 3, 4);
                return null;
            }
        });
    }
View Full Code Here

        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());
                logger.info(createTable.toString());
                openTable.insert(null, "test");
                db.createIndex("CREATE INDEX test_index ON test(name);");
                openTable.insert(null, "test1");
                return null;
            }
        });
    }
View Full Code Here

            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);");
                final ISqlJetTable openTable = createDb.getTable(createTable.getName());
                openTable.insert(null, "test");
                openTable.insert(null, "test1");
                return null;
            }
        });
    }
View Full Code Here

TOP

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

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.