Search in sources :

Example 1 with Use

use of com.facebook.presto.sql.tree.Use in project presto by prestodb.

the class Console method processSessionParameterChange.

static ClientSession processSessionParameterChange(Object parsedStatement, ClientSession session, Map<String, String> existingProperties, Map<String, String> existingPreparedStatements) {
    if (parsedStatement instanceof Use) {
        Use use = (Use) parsedStatement;
        session = withCatalogAndSchema(session, use.getCatalog().orElse(session.getCatalog()), use.getSchema());
        session = withProperties(session, existingProperties);
        session = withPreparedStatements(session, existingPreparedStatements);
    }
    return session;
}
Also used : Use(com.facebook.presto.sql.tree.Use)

Example 2 with Use

use of com.facebook.presto.sql.tree.Use in project presto by prestodb.

the class TestSqlParser method testUse.

@Test
public void testUse() {
    assertStatement("Use test_schema", new Use(Optional.empty(), identifier("test_schema")));
    assertStatement("Use test_catalog.test_schema", new Use(Optional.of(identifier("test_catalog")), new Identifier("test_schema")));
    assertStatement("Use \"test_schema\"", new Use(Optional.empty(), quotedIdentifier("test_schema")));
    assertStatement("Use \"test_catalog\".\"test_schema\"", new Use(Optional.of(quotedIdentifier("test_catalog")), quotedIdentifier("test_schema")));
}
Also used : Identifier(com.facebook.presto.sql.tree.Identifier) QueryUtil.quotedIdentifier(com.facebook.presto.sql.QueryUtil.quotedIdentifier) Use(com.facebook.presto.sql.tree.Use) Test(org.testng.annotations.Test)

Aggregations

Use (com.facebook.presto.sql.tree.Use)2 QueryUtil.quotedIdentifier (com.facebook.presto.sql.QueryUtil.quotedIdentifier)1 Identifier (com.facebook.presto.sql.tree.Identifier)1 Test (org.testng.annotations.Test)1