@Override public MutationState execute() throws SQLException { MetaDataClient client = new MetaDataClient(getContext().getConnection()); return client.dropTable(ExecutableDropTableStatement.this); } };
private void gracefullyDropView(PhoenixConnection phoenixConnection, Configuration configuration, Key key) throws Exception { PhoenixConnection tenantConnection; if (key.getTenantId() != null) { Properties tenantProps = new Properties(); tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, key.getTenantId()); tenantConnection = ConnectionUtil.getInputConnection(configuration, tenantProps). unwrap(PhoenixConnection.class); } else { tenantConnection = phoenixConnection; } MetaDataClient client = new MetaDataClient(tenantConnection); org.apache.phoenix.parse.TableName pTableName = org.apache.phoenix.parse.TableName .create(key.getSchemaName(), key.getTableName()); try { client.dropTable( new DropTableStatement(pTableName, PTableType.VIEW, false, true, true)); } catch (TableNotFoundException e) { LOG.info("Ignoring view " + pTableName + " as it has already been dropped"); } }
.create(Bytes.toString(viewSchemaName), Bytes.toString(viewName)); try { client.dropTable( new DropTableStatement(viewTableName, PTableType.VIEW, true, true, true));
public MutationState dropIndex(DropIndexStatement statement) throws SQLException { String schemaName = statement.getTableName().getSchemaName(); String tableName = statement.getIndexName().getName(); String parentTableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, parentTableName, PTableType.INDEX, statement.ifExists(), false, false); }
public MutationState dropTable(DropTableStatement statement) throws SQLException { String schemaName = connection.getSchema() != null && statement.getTableName().getSchemaName() == null ? connection.getSchema() : statement.getTableName().getSchemaName(); String tableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, null, statement.getTableType(), statement.ifExists(), statement.cascade(), statement.getSkipAddingParentColumns()); }
@Override public MutationState execute() throws SQLException { MetaDataClient client = new MetaDataClient(getContext().getConnection()); return client.dropTable(ExecutableDropTableStatement.this); } };
@Override public MutationState execute() throws SQLException { MetaDataClient client = new MetaDataClient(getContext().getConnection()); return client.dropTable(ExecutableDropTableStatement.this); } };
private void gracefullyDropView(PhoenixConnection phoenixConnection, Configuration configuration, Key key) throws Exception { PhoenixConnection tenantConnection; if (key.getTenantId() != null) { Properties tenantProps = new Properties(); tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, key.getTenantId()); tenantConnection = ConnectionUtil.getInputConnection(configuration, tenantProps). unwrap(PhoenixConnection.class); } else { tenantConnection = phoenixConnection; } MetaDataClient client = new MetaDataClient(tenantConnection); org.apache.phoenix.parse.TableName pTableName = org.apache.phoenix.parse.TableName .create(key.getSchemaName(), key.getTableName()); try { client.dropTable( new DropTableStatement(pTableName, PTableType.VIEW, false, true, true)); } catch (TableNotFoundException e) { LOG.info("Ignoring view " + pTableName + " as it has already been dropped"); } }
.create(Bytes.toString(viewSchemaName), Bytes.toString(viewName)); try { client.dropTable( new DropTableStatement(viewTableName, PTableType.VIEW, true, true, true));
public MutationState dropIndex(DropIndexStatement statement) throws SQLException { String schemaName = statement.getTableName().getSchemaName(); String tableName = statement.getIndexName().getName(); String parentTableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, parentTableName, PTableType.INDEX, statement.ifExists(), false, false); }
public MutationState dropIndex(DropIndexStatement statement) throws SQLException { String schemaName = statement.getTableName().getSchemaName(); String tableName = statement.getIndexName().getName(); String parentTableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, parentTableName, PTableType.INDEX, statement.ifExists(), false); }
public MutationState dropTable(DropTableStatement statement) throws SQLException { String schemaName = connection.getSchema() != null && statement.getTableName().getSchemaName() == null ? connection.getSchema() : statement.getTableName().getSchemaName(); String tableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, null, statement.getTableType(), statement.ifExists(), statement.cascade(), statement.getSkipAddingParentColumns()); }
public MutationState dropTable(DropTableStatement statement) throws SQLException { String schemaName = connection.getSchema() != null && statement.getTableName().getSchemaName() == null ? connection.getSchema() : statement.getTableName().getSchemaName(); String tableName = statement.getTableName().getTableName(); return dropTable(schemaName, tableName, null, statement.getTableType(), statement.ifExists(), statement.cascade()); }