本文整理汇总了Java中com.foundationdb.sql.parser.DropTableNode类的典型用法代码示例。如果您正苦于以下问题:Java DropTableNode类的具体用法?Java DropTableNode怎么用?Java DropTableNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DropTableNode类属于com.foundationdb.sql.parser包,在下文中一共展示了DropTableNode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runDDL
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
protected void runDDL(String sql) throws Exception {
for (StatementNode stmt : new SQLParser().parseStatements(sql)) {
switch (stmt.getNodeType()) {
case NodeTypes.CREATE_TABLE_NODE:
TableDDL.createTable(ddl(), session(), SCHEMA, (CreateTableNode)stmt, null);
break;
case NodeTypes.DROP_TABLE_NODE:
TableDDL.dropTable(ddl(), session(), SCHEMA, (DropTableNode)stmt, null);
break;
case NodeTypes.ALTER_TABLE_NODE:
AlterTableDDL.alterTable(ddl(), dml(), session(), SCHEMA, (AlterTableNode)stmt, null);
break;
case NodeTypes.RENAME_NODE:
TableDDL.renameTable(ddl(), session(), SCHEMA, (RenameNode)stmt);
break;
default:
fail("Unsupported statement: " + stmt);
}
}
}
示例2: dropExistingTableWithIfExists
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test
public void dropExistingTableWithIfExists() throws StandardException
{
String sql = "DROP TABLE IF EXISTS " + DEFAULT_TABLE;
createTableSimpleGenerateAIS();
StatementNode node = parser.parseStatement(sql);
assertTrue(node instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)node, null);
}
示例3: dropNonExistingTableWithIfExists
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test
public void dropNonExistingTableWithIfExists() throws StandardException
{
String sql = "DROP TABLE IF EXISTS chair";
createTableSimpleGenerateAIS();
StatementNode node = parser.parseStatement(sql);
assertTrue(node instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)node, null);
}
示例4: dropTableSimple
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test
public void dropTableSimple() throws Exception {
String sql = "DROP TABLE t1";
dropTable = TableName.create(DEFAULT_SCHEMA, DEFAULT_TABLE);
createTableSimpleGenerateAIS ();
StatementNode stmt = parser.parseStatement(sql);
assertTrue (stmt instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)stmt, null);
}
示例5: dropTableSchemaTrue
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test
public void dropTableSchemaTrue() throws Exception {
String sql = "DROP TABLE test.t1";
dropTable = TableName.create(DEFAULT_SCHEMA, DEFAULT_TABLE);
createTableSimpleGenerateAIS ();
StatementNode stmt = parser.parseStatement(sql);
assertTrue (stmt instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)stmt, null);
}
示例6: dropTableSchema
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test (expected=NoSuchTableException.class)
public void dropTableSchema() throws Exception {
String sql = "DROP TABLE foo.t1";
createTableSimpleGenerateAIS ();
dropTable = TableName.create("foo", DEFAULT_TABLE);
StatementNode stmt = parser.parseStatement(sql);
assertTrue (stmt instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)stmt, null);
}
示例7: dropTableQuoted
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
@Test (expected=NoSuchTableException.class)
public void dropTableQuoted() throws Exception {
String sql = "DROP TABLE \"T1\"";
dropTable = TableName.create(DEFAULT_SCHEMA, "T1");
createTableSimpleGenerateAIS ();
StatementNode stmt = parser.parseStatement(sql);
assertTrue (stmt instanceof DropTableNode);
TableDDL.dropTable(ddlFunctions, null, DEFAULT_SCHEMA, (DropTableNode)stmt, null);
}
示例8: analyse
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
public static DDLParsInf analyse(QueryTreeNode ast)
throws SQLSyntaxErrorException {
DDLParsInf parsInf=new DDLParsInf();
DDLStatementNode ddlNode = (DDLStatementNode) ast;
String tableName=null;
if(ddlNode instanceof CreateTableNode)
{
tableName=((CreateTableNode)ddlNode).getObjectName().getTableName();
}else if(ddlNode instanceof AlterTableNode)
{
tableName=((AlterTableNode)ddlNode).getObjectName().getTableName();
}else if(ddlNode instanceof DropTableNode)
{
tableName=((DropTableNode)ddlNode).getObjectName().getTableName();
}else if(ddlNode instanceof CreateIndexNode)
{
tableName=((CreateIndexNode)ddlNode).getObjectName().getTableName();
}else if(ddlNode instanceof DropIndexNode)
{
tableName=((DropIndexNode)ddlNode).getObjectName().getTableName();
}else
{
throw new SQLSyntaxErrorException("stmt not supported yet: "+ddlNode.getClass().getSimpleName());
}
parsInf.tableName=tableName.toUpperCase();
return parsInf;
}
示例9: execute
import com.foundationdb.sql.parser.DropTableNode; //导入依赖的package包/类
public static void execute(DDLStatementNode ddl, String sql,
ServerQueryContext<?> context) {
ServerSession server = context.getServer();
AkibanInformationSchema ais = server.getAIS();
String schema = server.getDefaultSchemaName();
logger.info("DDL in {}: {}", schema, sql);
DDLFunctions ddlFunctions = server.getDXL().ddlFunctions();
Session session = server.getSession();
switch (ddl.getNodeType()) {
case NodeTypes.CREATE_SCHEMA_NODE:
SchemaDDL.createSchema(ais, schema, (CreateSchemaNode)ddl, context);
return;
case NodeTypes.DROP_SCHEMA_NODE:
SchemaDDL.dropSchema(ddlFunctions, session, (DropSchemaNode)ddl, context);
return;
case NodeTypes.CREATE_TABLE_NODE:
TableDDL.createTable(ddlFunctions, session, schema, (CreateTableNode)ddl, context);
return;
case NodeTypes.DROP_TABLE_NODE:
TableDDL.dropTable(ddlFunctions, session, schema, (DropTableNode)ddl, context);
return;
case NodeTypes.DROP_GROUP_NODE:
TableDDL.dropGroup(ddlFunctions, session, schema, (DropGroupNode)ddl, context);
return;
case NodeTypes.CREATE_VIEW_NODE:
ViewDDL.createView(ddlFunctions, session, schema, (CreateViewNode)ddl,
server.getBinderContext(), context, server);
return;
case NodeTypes.DROP_VIEW_NODE:
ViewDDL.dropView(ddlFunctions, session, schema, (DropViewNode)ddl,
server.getBinderContext(), context);
return;
case NodeTypes.CREATE_INDEX_NODE:
IndexDDL.createIndex(ddlFunctions, session, schema, (CreateIndexNode)ddl, context);
return;
case NodeTypes.DROP_INDEX_NODE:
IndexDDL.dropIndex(ddlFunctions, session, schema, (DropIndexNode)ddl, context);
return;
case NodeTypes.ALTER_TABLE_NODE:
AlterTableDDL.alterTable(ddlFunctions, server.getDXL().dmlFunctions(), session, schema, (AlterTableNode)ddl, context);
return;
case NodeTypes.RENAME_NODE:
switch (((RenameNode)ddl).getRenameType()) {
case INDEX:
IndexDDL.renameIndex(ddlFunctions, session, schema, (RenameNode)ddl);
return;
case TABLE:
TableDDL.renameTable(ddlFunctions, session, schema, (RenameNode)ddl);
return;
}
break;
case NodeTypes.CREATE_SEQUENCE_NODE:
SequenceDDL.createSequence(ddlFunctions, session, schema, (CreateSequenceNode)ddl);
return;
case NodeTypes.DROP_SEQUENCE_NODE:
SequenceDDL.dropSequence(ddlFunctions, session, schema, (DropSequenceNode)ddl, context);
return;
case NodeTypes.CREATE_ALIAS_NODE:
switch (((CreateAliasNode)ddl).getAliasType()) {
case PROCEDURE:
case FUNCTION:
RoutineDDL.createRoutine(ddlFunctions, server.getRoutineLoader(), session, schema, (CreateAliasNode)ddl);
return;
}
break;
case NodeTypes.DROP_ALIAS_NODE:
switch (((DropAliasNode)ddl).getAliasType()) {
case PROCEDURE:
case FUNCTION:
RoutineDDL.dropRoutine(ddlFunctions, server.getRoutineLoader(), session, schema, (DropAliasNode)ddl, context);
return;
}
break;
case NodeTypes.CREATE_TRIGGER_NODE:
throw new UnsupportedTriggerException();
}
throw new UnsupportedSQLException(ddl.statementToString(), ddl);
}