Package com.salesforce.phoenix.jdbc

Examples of com.salesforce.phoenix.jdbc.PhoenixConnection.createStatement()


    @Test
    public void testViewInvalidation() throws Exception {
        Properties props = new Properties(TestUtil.TEST_PROPERTIES);
        PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class);
        String ct = "CREATE TABLE t (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))";
        conn.createStatement().execute(ct);
        conn.createStatement().execute("CREATE VIEW v3 AS SELECT * FROM t WHERE v = 'bar'");
       
        // TODO: should it be an error to remove columns from a VIEW that we're defined there?
        // TOOD: should we require an ALTER VIEW instead of ALTER TABLE?
        conn.createStatement().execute("ALTER VIEW v3 DROP COLUMN v");
View Full Code Here


    public void testViewInvalidation() throws Exception {
        Properties props = new Properties(TestUtil.TEST_PROPERTIES);
        PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class);
        String ct = "CREATE TABLE t (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))";
        conn.createStatement().execute(ct);
        conn.createStatement().execute("CREATE VIEW v3 AS SELECT * FROM t WHERE v = 'bar'");
       
        // TODO: should it be an error to remove columns from a VIEW that we're defined there?
        // TOOD: should we require an ALTER VIEW instead of ALTER TABLE?
        conn.createStatement().execute("ALTER VIEW v3 DROP COLUMN v");
        try {
View Full Code Here

        conn.createStatement().execute(ct);
        conn.createStatement().execute("CREATE VIEW v3 AS SELECT * FROM t WHERE v = 'bar'");
       
        // TODO: should it be an error to remove columns from a VIEW that we're defined there?
        // TOOD: should we require an ALTER VIEW instead of ALTER TABLE?
        conn.createStatement().execute("ALTER VIEW v3 DROP COLUMN v");
        try {
            conn.createStatement().executeQuery("SELECT * FROM v3");
            fail();
        } catch (ColumnNotFoundException e) {
           
View Full Code Here

       
        // TODO: should it be an error to remove columns from a VIEW that we're defined there?
        // TOOD: should we require an ALTER VIEW instead of ALTER TABLE?
        conn.createStatement().execute("ALTER VIEW v3 DROP COLUMN v");
        try {
            conn.createStatement().executeQuery("SELECT * FROM v3");
            fail();
        } catch (ColumnNotFoundException e) {
           
        }
       
View Full Code Here

        } catch (ColumnNotFoundException e) {
           
        }
       
        // No error, as v still exists in t
        conn.createStatement().execute("CREATE VIEW v4 AS SELECT * FROM t WHERE v = 'bas'");

        // No error, even though view is invalid
        conn.createStatement().execute("DROP VIEW v3");
    }

View Full Code Here

       
        // No error, as v still exists in t
        conn.createStatement().execute("CREATE VIEW v4 AS SELECT * FROM t WHERE v = 'bas'");

        // No error, even though view is invalid
        conn.createStatement().execute("DROP VIEW v3");
    }


    @Test
    public void testInvalidUpsertSelect() throws Exception {
View Full Code Here

    @Test
    public void testInvalidUpsertSelect() throws Exception {
        Properties props = new Properties(TestUtil.TEST_PROPERTIES);
        PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class);
        conn.createStatement().execute("CREATE TABLE t1 (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))");
        conn.createStatement().execute("CREATE TABLE t2 (k3 INTEGER NOT NULL, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k3))");
        conn.createStatement().execute("CREATE VIEW v1 AS SELECT * FROM t1 WHERE k1 = 1");
       
        try {
            conn.createStatement().executeUpdate("UPSERT INTO v1 SELECT k3,'foo',v FROM t2");
View Full Code Here

    @Test
    public void testInvalidUpsertSelect() throws Exception {
        Properties props = new Properties(TestUtil.TEST_PROPERTIES);
        PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class);
        conn.createStatement().execute("CREATE TABLE t1 (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))");
        conn.createStatement().execute("CREATE TABLE t2 (k3 INTEGER NOT NULL, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k3))");
        conn.createStatement().execute("CREATE VIEW v1 AS SELECT * FROM t1 WHERE k1 = 1");
       
        try {
            conn.createStatement().executeUpdate("UPSERT INTO v1 SELECT k3,'foo',v FROM t2");
            fail();
View Full Code Here

    public void testInvalidUpsertSelect() throws Exception {
        Properties props = new Properties(TestUtil.TEST_PROPERTIES);
        PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class);
        conn.createStatement().execute("CREATE TABLE t1 (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))");
        conn.createStatement().execute("CREATE TABLE t2 (k3 INTEGER NOT NULL, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k3))");
        conn.createStatement().execute("CREATE VIEW v1 AS SELECT * FROM t1 WHERE k1 = 1");
       
        try {
            conn.createStatement().executeUpdate("UPSERT INTO v1 SELECT k3,'foo',v FROM t2");
            fail();
        } catch (SQLException e) {
View Full Code Here

        conn.createStatement().execute("CREATE TABLE t1 (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))");
        conn.createStatement().execute("CREATE TABLE t2 (k3 INTEGER NOT NULL, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k3))");
        conn.createStatement().execute("CREATE VIEW v1 AS SELECT * FROM t1 WHERE k1 = 1");
       
        try {
            conn.createStatement().executeUpdate("UPSERT INTO v1 SELECT k3,'foo',v FROM t2");
            fail();
        } catch (SQLException e) {
            assertEquals(SQLExceptionCode.CANNOT_UPDATE_VIEW_COLUMN.getErrorCode(), e.getErrorCode());
        }
    }
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.