Examples of DropTable


Examples of com.uwyn.rife.database.queries.DropTable

      .whereParameter("botname", "=")
      .whereParameterAnd("channel", "=")
      .whereParameterAnd("servername", "=")
      .whereParameterAnd("lower(nickname)", "currentnickname", "=");

    mDropTableSeen = new DropTable(getDatasource())
      .table("seen");
  }
View Full Code Here

Examples of com.uwyn.rife.database.queries.DropTable

      .whereParameterAnd("channel", "=")
      .whereParameterAnd("servername", "=")
      .whereParameterAnd("moment", "begin", ">=")
      .whereParameterAnd("moment", "end", "<");

    mDropTableLog = new DropTable(getDatasource())
      .table(mCreateTableLog.getTable());

    mDropGetLogMessagesIndex = "DROP INDEX log_getlog_idx";
  }
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

            assertTrue(row.getValue(0) instanceof Integer);
            assertTrue(row.getValue(1) instanceof Map);
            assertTrue(row.getValue(2) instanceof List);

        } finally {
            dc.executeUpdate(new DropTable(table));
        }

    }
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

        assertTrue(ds.next());
        assertEquals("Row[values=[baz]]", ds.getRow().toString());
        assertFalse(ds.next());
        ds.close();

        dc.executeUpdate(new DropTable(table));

        assertNull(schema.getTableByName("test_table"));
    }
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

    public static void interpretationOfNulls(Connection conn) throws Exception {
        final JdbcDataContext dc = new JdbcDataContext(conn);
        final Schema schema = dc.getDefaultSchema();

        if (dc.getTableByQualifiedLabel("test_table") != null) {
            dc.executeUpdate(new DropTable(schema, "test_table"));
        }

        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
                ColumnCreationBuilder createTableBuilder = cb.createTable(schema, "test_table").withColumn("id")
                        .ofType(ColumnType.FLOAT).withColumn("code").ofType(ColumnType.VARCHAR).ofSize(10);
                Table table = createTableBuilder.execute();

                cb.insertInto(table).value("id", 1.0).value("code", "C01").execute();
                cb.insertInto(table).value("id", 2.0).value("code", "C02").execute();
                cb.insertInto(table).value("id", 3.0).value("code", null).execute();
                cb.insertInto(table).value("id", 4.0).value("code", "C02").execute();
            }
        });

        assertEquals(1, getCount(dc.query().from("test_table").selectCount().where("code").isNull().execute()));
        assertEquals(3, getCount(dc.query().from("test_table").selectCount().where("code").isNotNull().execute()));
        assertEquals(2, getCount(dc.query().from("test_table").selectCount().where("code").ne("C02").execute()));

        // we put the results into a map, because databases are not in agreement
        // wrt. if NULL is greater than or less than other values, so ordering
        // does not help
        final Map<Object, Object> map = new HashMap<Object, Object>();

        DataSet ds = dc.query().from("test_table").select("code").selectCount().groupBy("code").execute();
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertFalse(ds.next());

        ds.close();

        dc.executeUpdate(new DropTable(schema, "test_table"));

        assertEquals(1, ((Number) map.get(null)).intValue());
        assertEquals(1, ((Number) map.get("C01")).intValue());
        assertEquals(2, ((Number) map.get("C02")).intValue());
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

        final JdbcDataContext dc = new JdbcDataContext(conn);
        final Schema schema = dc.getDefaultSchema();

        if (dc.getTableByQualifiedLabel("test_table") != null) {
            dc.executeUpdate(new DropTable("test_table"));
        }

        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

    public static void interpretationOfNulls(Connection conn) throws Exception {
        final JdbcDataContext dc = new JdbcDataContext(conn);
        final Schema schema = dc.getDefaultSchema();

        if (dc.getTableByQualifiedLabel("test_table") != null) {
            dc.executeUpdate(new DropTable(schema, "test_table"));
        }

        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
                ColumnCreationBuilder createTableBuilder = cb.createTable(schema, "test_table").withColumn("id")
                        .ofType(ColumnType.FLOAT).withColumn("code").ofType(ColumnType.VARCHAR).ofSize(10);
                Table table = createTableBuilder.execute();

                cb.insertInto(table).value("id", 1.0).value("code", "C01").execute();
                cb.insertInto(table).value("id", 2.0).value("code", "C02").execute();
                cb.insertInto(table).value("id", 3.0).value("code", null).execute();
                cb.insertInto(table).value("id", 4.0).value("code", "C02").execute();
            }
        });

        assertEquals(1, getCount(dc.query().from("test_table").selectCount().where("code").isNull().execute()));
        assertEquals(3, getCount(dc.query().from("test_table").selectCount().where("code").isNotNull().execute()));
        assertEquals(2, getCount(dc.query().from("test_table").selectCount().where("code").ne("C02").execute()));

        // we put the results into a map, because databases are not in agreement
        // wrt. if NULL is greater than or less than other values, so ordering
        // does not help
        final Map<Object, Object> map = new HashMap<Object, Object>();

        DataSet ds = dc.query().from("test_table").select("code").selectCount().groupBy("code").execute();
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertTrue(ds.next());
        map.put(ds.getRow().getValue(0), ds.getRow().getValue(1));
        assertFalse(ds.next());

        ds.close();

        dc.executeUpdate(new DropTable(schema, "test_table"));

        assertEquals(1, ((Number) map.get(null)).intValue());
        assertEquals(1, ((Number) map.get("C01")).intValue());
        assertEquals(2, ((Number) map.get("C02")).intValue());
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

        final JdbcDataContext dc = new JdbcDataContext(conn);
        final Schema schema = dc.getDefaultSchema();

        if (dc.getTableByQualifiedLabel("test_table") != null) {
            dc.executeUpdate(new DropTable("test_table"));
        }

        dc.executeUpdate(new UpdateScript() {
            @Override
            public void run(UpdateCallback cb) {
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

            assertTrue(row.getValue(0) instanceof Integer);
            assertTrue(row.getValue(1) instanceof Map);
            assertTrue(row.getValue(2) instanceof List);

        } finally {
            dc.executeUpdate(new DropTable(table));
        }

    }
View Full Code Here

Examples of org.apache.metamodel.drop.DropTable

            assertTrue(row.getValue(0) instanceof Integer);
            assertTrue(row.getValue(1) instanceof Map);
            assertTrue(row.getValue(2) instanceof List);

        } finally {
            dc.executeUpdate(new DropTable(table));
        }

    }
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.