Package org.tmatesoft.sqljet.core.schema

Examples of org.tmatesoft.sqljet.core.schema.ISqlJetTableDef


    @Test
    public void tableDef() throws SqlJetException {
        final ISqlJetTable table = dbCopy.getTable(TABLE);

        final ISqlJetTableDef tableDef = table.getDefinition();

        Assert.assertNotNull(tableDef);

        final String tableName = tableDef.getName();

        Assert.assertNotNull(tableName);
        Assert.assertEquals(TABLE, tableName);

        final List<ISqlJetColumnDef> columns = tableDef.getColumns();

        Assert.assertNotNull(columns);
        Assert.assertEquals(4, columns.size());
    }
View Full Code Here


    @Test
    public void createDbInMemory() throws Exception {
        SqlJetDb db = new SqlJetDb(SqlJetDb.IN_MEMORY, true);
        db.open();
        try {
            final ISqlJetTableDef tDef = db.createTable("create table t(a integer primary key, b text);");
            final ISqlJetTable t = db.getTable(tDef.getName());
            t.insert(null, "hello");
            t.insert(null, "world");
            db.runReadTransaction(new ISqlJetTransaction() {
                public Object run(SqlJetDb db) throws SqlJetException {
                    final ISqlJetCursor c = t.open();
View Full Code Here

        assertEquals(SqlJetTypeAffinity.NUMERIC, SqlJetTypeAffinity.decode("byte"));
    }

    public void testSchema() throws SqlJetException {
        String sql = "create table t (c1 int primary key, c2 varchar, c3 super double, c4 short unique, c5 blob, c6)";
        ISqlJetTableDef table = new SqlJetTableDef(parse(sql), 0);
        ISqlJetColumnDef c1 = table.getColumn("c1");
        assertEquals(SqlJetTypeAffinity.INTEGER, c1.getTypeAffinity());
        ISqlJetColumnDef c2 = table.getColumn("c2");
        assertEquals(SqlJetTypeAffinity.TEXT, c2.getTypeAffinity());
        ISqlJetColumnDef c3 = table.getColumn("c3");
        assertEquals(SqlJetTypeAffinity.REAL, c3.getTypeAffinity());
        ISqlJetColumnDef c4 = table.getColumn("c4");
        assertEquals(SqlJetTypeAffinity.NUMERIC, c4.getTypeAffinity());
        ISqlJetColumnDef c5 = table.getColumn("c5");
        assertEquals(SqlJetTypeAffinity.NONE, c5.getTypeAffinity());
        ISqlJetColumnDef c6 = table.getColumn("c6");
        assertEquals(SqlJetTypeAffinity.NONE, c6.getTypeAffinity());
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.schema.ISqlJetTableDef

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.