本文整理汇总了Java中com.facebook.presto.sql.tree.Use类的典型用法代码示例。如果您正苦于以下问题:Java Use类的具体用法?Java Use怎么用?Java Use使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Use类属于com.facebook.presto.sql.tree包,在下文中一共展示了Use类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeUpdate
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
@Override
public int executeUpdate(String sql) throws SQLException {
//System.out.println("QUERY: ["+sql+"]");
sql = sql.replaceAll("\r", " ").replaceAll("\n", " ").trim();
// custom stuff to support UPDATE statements since Presto does not parse it
if(sql.toLowerCase().startsWith("update")){
return updateState.execute(sql);
}
com.facebook.presto.sql.tree.Statement statement = parser.createStatement(sql);
if(statement instanceof Query) throw new SQLException("A regular query cannot be executed as an Update");
if(statement instanceof Insert){
//if(connection.getSchema() == null) throw new SQLException("No active index set for this driver. Pleas specify an active index or alias by executing 'USE <index/alias>' first");
return updateState.execute(sql, (Insert)statement, connection.getSchema());
}else if(statement instanceof Delete){
if(connection.getSchema() == null) throw new SQLException("No active index set for this driver. Pleas specify an active index or alias by executing 'USE <index/alias>' first");
return updateState.execute(sql, (Delete)statement, connection.getSchema());
}else if(statement instanceof CreateTable){
return updateState.execute(sql, (CreateTable)statement, connection.getSchema());
}else if(statement instanceof CreateTableAsSelect){
return updateState.execute(sql, (CreateTableAsSelect)statement, connection.getSchema());
}else if(statement instanceof CreateView){
return updateState.execute(sql, (CreateView)statement, connection.getSchema());
}else if(statement instanceof Use){
connection.setSchema( ((Use)statement).getSchema());
//connection.getTypeMap(); // updates the type mappings found in properties
return 0;
}else if(statement instanceof DropTable){
return updateState.execute(sql, (DropTable)statement);
}else if(statement instanceof DropView){
return updateState.execute(sql, (DropView)statement);
}throw new SQLFeatureNotSupportedException("Unable to parse provided update sql");
}
示例2: processSessionParameterChange
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
static ClientSession processSessionParameterChange(Object parsedStatement, ClientSession session, Map<String, String> existingProperties)
{
if (parsedStatement instanceof Use) {
Use use = (Use) parsedStatement;
session = withCatalogAndSchema(session, use.getCatalog().orElse(session.getCatalog()), use.getSchema());
session = withSessionProperties(session, existingProperties);
}
return session;
}
示例3: visitUse
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
@Override
protected RelationType visitUse(Use node, AnalysisContext context)
{
analysis.setUpdateType("USE");
throw new SemanticException(NOT_SUPPORTED, node, "USE statement is not supported");
}
示例4: isSessionParameterChange
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
private static boolean isSessionParameterChange(Object statement)
{
return statement instanceof Use;
}
示例5: visitUse
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
@Override
public Node visitUse(SqlBaseParser.UseContext context)
{
return new Use(getLocation(context), getTextIfPresent(context.catalog), context.schema.getText());
}
示例6: visitUse
import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
@Override
protected CatalogSchemaContext visitUse(Use node, CatalogSchemaContext context)
{
return new CatalogSchemaContext(node.getCatalog().orElse(context.getCatalog()), node.getSchema());
}