@Test (expected=NoSuchSchemaException.class) public void dropSchemaEmpty() throws Exception { String sql = "DROP SCHEMA EMPTY RESTRICT"; AkibanInformationSchema ais = new AkibanInformationSchema(); StatementNode stmt = parser.parseStatement(sql); assertTrue (stmt instanceof DropSchemaNode); DDLFunctions ddlFunctions = new TableDDLTest.DDLFunctionsMock(ais); SchemaDDL.dropSchema(ddlFunctions, null, (DropSchemaNode)stmt, null); }
public static void dropSchema (DDLFunctions ddlFunctions, Session session, DropSchemaNode dropSchema, QueryContext context) { AkibanInformationSchema ais = ddlFunctions.getAIS(session); final String schemaName = dropSchema.getSchemaName(); Schema curSchema = ais.getSchema(schemaName); if((curSchema == null) && skipOrThrow(context, dropSchema.getExistenceCheck(), curSchema, new NoSuchSchemaException(schemaName))) { return; } if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT || dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT) throw new ReferencedSchemaException(schemaName); else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE) ddlFunctions.dropSchema(session, schemaName); }
SchemaDDL { public static void dropSchema (DDLFunctions ddlFunctions, Session session, DropSchemaNode dropSchema, QueryContext context) { AkibanInformationSchema ais = ddlFunctions.getAIS(session); final String schemaName = dropSchema.getSchemaName(); Schema curSchema = ais.getSchema(schemaName); if((curSchema == null) && skipOrThrow(context, dropSchema.getExistenceCheck(), curSchema, new NoSuchSchemaException(schemaName))) { return; } if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT || dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT) throw new ReferencedSchemaException(schemaName); else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE) ddlFunctions.dropSchema(session, schemaName); } }
SchemaDDL { public static void dropSchema (DDLFunctions ddlFunctions, Session session, DropSchemaNode dropSchema, QueryContext context) { AkibanInformationSchema ais = ddlFunctions.getAIS(session); final String schemaName = dropSchema.getSchemaName(); Schema curSchema = ais.getSchema(schemaName); if((curSchema == null) && skipOrThrow(context, dropSchema.getExistenceCheck(), curSchema, new NoSuchSchemaException(schemaName))) { return; } if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT || dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT) throw new ReferencedSchemaException(schemaName); else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE) ddlFunctions.dropSchema(session, schemaName); } private  SchemaDDL(); }
SchemaDDL { public static void dropSchema (DDLFunctions ddlFunctions, Session session, DropSchemaNode dropSchema, QueryContext context) { AkibanInformationSchema ais = ddlFunctions.getAIS(session); final String schemaName = dropSchema.getSchemaName(); Schema curSchema = ais.getSchema(schemaName); if((curSchema == null) && skipOrThrow(context, dropSchema.getExistenceCheck(), curSchema, new NoSuchSchemaException(schemaName))) { return; } if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT || dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT) throw new ReferencedSchemaException(schemaName); else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE) ddlFunctions.dropSchema(session, schemaName); } private  SchemaDDL(); static void createSchema(AkibanInformationSchema ais,
                                   String defaultSchemaName,
                                   CreateSchemaNode createSchema,
                                   QueryContext context); static void dropSchema(DDLFunctions ddlFunctions,
            Session session,
            DropSchemaNode dropSchema,
            QueryContext context); }
SchemaDDL { public static void dropSchema (DDLFunctions ddlFunctions, Session session, DropSchemaNode dropSchema, QueryContext context) { AkibanInformationSchema ais = ddlFunctions.getAIS(session); final String schemaName = dropSchema.getSchemaName(); Schema curSchema = ais.getSchema(schemaName); if((curSchema == null) && skipOrThrow(context, dropSchema.getExistenceCheck(), curSchema, new NoSuchSchemaException(schemaName))) { return; } if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT || dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT) throw new ReferencedSchemaException(schemaName); else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE) ddlFunctions.dropSchema(session, schemaName); } private  SchemaDDL(); static void createSchema(AkibanInformationSchema ais,
                                   String defaultSchemaName,
                                   CreateSchemaNode createSchema,
                                   QueryContext context); static void dropSchema(DDLFunctions ddlFunctions,
            Session session,
            DropSchemaNode dropSchema,
            QueryContext context);  }