Package org.tmatesoft.sqljet.core.table

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


        db.commit();
        db.alterTable("alter table \"name with whitespace\" add column \"column with space\"");
        db.close();
        db.open();
        Assert.assertTrue(true);
        final ISqlJetTable table = db.getTable("name with whitespace");
        Assert.assertNotNull(table);
        final ISqlJetIndexDef indexDef = table.getIndexDef("name with whitespace 2");
        Assert.assertNotNull(indexDef);
    }
View Full Code Here


        db.createIndex(sql2);
        db.commit();
        db.alterTable("alter table \"name with whitespace\" rename to \"name with whitespace 3\"");
        db.close();
        db.open();
        final ISqlJetTable table = db.getTable("name with whitespace 3");
        Assert.assertNotNull(table);
        Assert.assertTrue(true);
        final ISqlJetTable table2 = db.getTable("name with whitespace 3");
        Assert.assertNotNull(table2);
        final ISqlJetIndexDef indexDef = table.getIndexDef("name with whitespace 2");
        Assert.assertNotNull(indexDef);
    }
View Full Code Here

        db.createTable(sql1);
        db.commit();
        db.close();
        db.open();
        Assert.assertTrue(true);
        final ISqlJetTable table = db.getTable(" name with \n whitespace ");
        Assert.assertNotNull(table);
    }
View Full Code Here

        db.createTable(sql1);
        db.commit();
        db.close();
        db.open();
        Assert.assertTrue(true);
        final ISqlJetTable table = db.getTable(" [name with \" \n whitespace] ");
        Assert.assertNotNull(table);
    }
View Full Code Here

        db.createTable(sql1);
        db.commit();
        db.close();
        db.open();
        Assert.assertTrue(true);
        final ISqlJetTable table = db.getTable(" [name with \" \n whitespace] ");
        Assert.assertNotNull(table);
    }
View Full Code Here

        private long batch = 0;
        private long id = 0;

        public Object run(SqlJetDb db) throws SqlJetException {
            final ISqlJetTable table = db.getTable(TABLE);
            int n_written = 0;
            batch++;
            while (n_written<TOTAL && !exit.get()) {
                table.insert(batch, ++id);
                n_written++;
            }
            logger.log(Level.INFO, "writer: inserted " + n_written);
            return null;
        }
View Full Code Here

        }
    }

    private static class Reader implements ISqlJetTransaction {
        public Object run(SqlJetDb db) throws SqlJetException {
            final ISqlJetTable table = db.getTable(TABLE);
            int n_read = 0;
            final ISqlJetCursor cursor = table.open();
            try {
                boolean more = !cursor.eof();
                while (n_read < TOTAL && more  && !exit.get()) {
                    n_read++;
                    cursor.getInteger(0);
View Full Code Here

        Assert.assertNotNull(db.getTable("tt"));
    }

    @Test
    public void caseInsensitiveIndicesTest() throws SqlJetException {
        final ISqlJetTable t = db.getTable(db.createTable("create table t(a int)").getName());
        db.createIndex("create index i on t(a)");
        db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                Assert.assertNotNull(t.getIndexDef("I"));
                Assert.assertNotNull(t.order("I"));
                Assert.assertNotNull(t.lookup("I", 0));
                Assert.assertNotNull(t.scope("I", new Object[] { 0 }, new Object[] { 0 }));
                return null;
            }
        });
        db.createIndex("create index II on t(a)");
        db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                Assert.assertNotNull(t.getIndexDef("ii"));
                Assert.assertNotNull(t.order("ii"));
                Assert.assertNotNull(t.scope("ii", new Object[] { 0 }, new Object[] { 0 }));
                return null;
            }
        });
    }
View Full Code Here

    @Test
    public void caseInsensitiveFieldsTest() throws SqlJetException {
        final ISqlJetTableDef def = db.createTable("create table t(a int, B int)");
        Assert.assertNotNull(def.getColumn("A"));
        Assert.assertNotNull(def.getColumn("b"));
        final ISqlJetTable table = db.getTable("T");
        Assert.assertNotNull(table);
        final ISqlJetTableDef def2 = table.getDefinition();
        Assert.assertNotNull(def2.getColumn("A"));
        Assert.assertNotNull(def2.getColumn("b"));
    }
View Full Code Here

    @Before
    public void setup() throws SqlJetException {
        db.createTable("CREATE TABLE halves (a REAL NOT NULL)");
        db.createIndex("CREATE INDEX halves_idx ON halves (a)");

        ISqlJetTable halves = db.getTable("halves");
        for (int i = 0; i < 10; i++) {
            halves.insert(((double)i) + .5);
        }

        db.createTable("CREATE TABLE wholes (a REAL NOT NULL)");
        db.createIndex("CREATE INDEX wholes_idx ON wholes (a)");

        ISqlJetTable wholes = db.getTable("wholes");
        for (int i = 0; i < 10; i++) {
            wholes.insert(((double)i));
        }
    }
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.