Package org.tmatesoft.sqljet.core.internal.schema

Examples of org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema


        runWithLock(new ISqlJetRunnableWithLock() {
            public Object runWithLock(SqlJetDb db) throws SqlJetException {
                btree.enter();
                try {
                    dbHandle.setOptions(new SqlJetOptions(btree, dbHandle));
                    btree.setSchema(new SqlJetSchema(dbHandle, btree));
                } finally {
                    btree.leave();
                }
                return null;
            }
View Full Code Here


    }

    @Test
    public void testSchema() throws SqlJetException {
        boolean passed = false;
        final ISqlJetSchema s = new SqlJetSchema(db, btreeCopy);
        for (String tableName : s.getTableNames()) {
            logger.info(tableName);
            passed = true;
        }
        Assert.assertTrue(passed);
    }
View Full Code Here

    }

    @Test
    public void testDataTable() throws SqlJetException {
        boolean passed = false;
        final SqlJetSchema s = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(s);
        final ISqlJetBtreeTable t = new SqlJetBtreeDataTable(btreeCopy, REP_CACHE_TABLE, false);
        for (ISqlJetBtreeRecord r = t.getRecord(); !t.eof(); t.next(), r = t.getRecord()) {
            final int fields = r.getFieldsCount();
            for (int i = 0; i < fields; i++) {
View Full Code Here

    }

    @Test
    public void testIndexTable() throws SqlJetException {
        boolean passed = false;
        final SqlJetSchema s = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(s);
        final String index = s.getIndexes(REP_CACHE_TABLE).iterator().next().getName();
        Assert.assertNotNull(index);
        final ISqlJetBtreeTable t = new SqlJetBtreeIndexTable(btreeCopy, index, false);
        for (ISqlJetBtreeRecord r = t.getRecord(); !t.eof(); t.next(), r = t.getRecord()) {
            final int fields = r.getFieldsCount();
            for (int i = 0; i < fields; i++) {
View Full Code Here

        Assert.assertTrue(passed);
    }

    @Test
    public void testRecordCompare() throws SqlJetException {
        final SqlJetSchema s = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(s);
        final ISqlJetBtreeDataTable d = new SqlJetBtreeDataTable(btreeCopy, REP_CACHE_TABLE, false);
        final ISqlJetBtreeRecord r = d.getRecord();
        final ISqlJetVdbeMem f = r.getFields().get(0);
        final ISqlJetMemoryPointer v = f.valueText(SqlJetEncoding.UTF8);
View Full Code Here

    }

    @Test
    public void testIndexLookup() throws SqlJetException {
        boolean passed = false;
        final SqlJetSchema schema = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(schema);
        for (int i = 0; i < REPEATS_COUNT; i++) {
            final String hash = getRandomHash(schema);
            if (null == hash)
                break;
View Full Code Here

        Assert.assertTrue(passed);
    }

    @Test
    public void testIndexLookupIncorrect() throws SqlJetException {
        final SqlJetSchema schema = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(schema);
        boolean failed = hashIndexLookupTest(schema, "incorrect");
        Assert.assertTrue(!failed);
    }
View Full Code Here

        }
    }

    @Test
    public void testInsertOnce() throws SqlJetException {
        final SqlJetSchema schema = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(schema);
        final ISqlJetBtreeDataTable data = new SqlJetBtreeDataTable(btreeCopy, REP_CACHE_TABLE, true);
        final String idx = schema.getIndexes(REP_CACHE_TABLE).iterator().next().getName();
        Assert.assertNotNull(idx);
        final ISqlJetBtreeIndexTable index = new SqlJetBtreeIndexTable(btreeCopy, idx, true);
        btreeCopy.beginTrans(SqlJetTransactionMode.WRITE);
        insertHash(schema, data, index, "TEST");
        btreeCopy.commit();
View Full Code Here

        btreeCopy.commit();
    }

    @Test
    public void testInsertRepeatlyShort() throws SqlJetException {
        final SqlJetSchema schema = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(schema);
        final ISqlJetBtreeDataTable data = new SqlJetBtreeDataTable(btreeCopy, REP_CACHE_TABLE, true);
        final String idx = schema.getIndexes(REP_CACHE_TABLE).iterator().next().getName();
        Assert.assertNotNull(idx);
        final ISqlJetBtreeIndexTable index = new SqlJetBtreeIndexTable(btreeCopy, idx, true);
        for (int i = 0; i < REPEATS_COUNT; i++) {
            btreeCopy.beginTrans(SqlJetTransactionMode.WRITE);
            insertHash(schema, data, index, String.valueOf(i));
View Full Code Here

        }
    }

    @Test
    public void testInsertRepeatlyLong() throws SqlJetException {
        final SqlJetSchema schema = new SqlJetSchema(db, btreeCopy);
        btreeCopy.setSchema(schema);
        final ISqlJetBtreeDataTable data = new SqlJetBtreeDataTable(btreeCopy, REP_CACHE_TABLE, true);
        final String idx = schema.getIndexes(REP_CACHE_TABLE).iterator().next().getName();
        Assert.assertNotNull(idx);
        final ISqlJetBtreeIndexTable index = new SqlJetBtreeIndexTable(btreeCopy, idx, true);
        btreeCopy.beginTrans(SqlJetTransactionMode.WRITE);
        for (int i = 0; i < REPEATS_COUNT; i++) {
            insertHash(schema, data, index, String.valueOf(i));
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema

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.