本文整理匯總了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());
}