当前位置: 首页>>代码示例>>Java>>正文


Java Use类代码示例

本文整理汇总了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");
}
 
开发者ID:Anchormen,项目名称:sql4es,代码行数:34,代码来源:ESStatement.java

示例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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:Console.java

示例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");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:7,代码来源:StatementAnalyzer.java

示例4: isSessionParameterChange

import com.facebook.presto.sql.tree.Use; //导入依赖的package包/类
private static boolean isSessionParameterChange(Object statement)
{
    return statement instanceof Use;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:5,代码来源:Console.java

示例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());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:6,代码来源:AstBuilder.java

示例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());
}
 
开发者ID:airbnb,项目名称:airpal,代码行数:6,代码来源:InputReferenceExtractor.java


注:本文中的com.facebook.presto.sql.tree.Use类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。