當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。