class 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;
        }
        // 1 == RESTRICT, meaning no drop if the schema isn't empty
        if (dropSchema.getDropBehavior() == StatementType.DROP_RESTRICT ||
                dropSchema.getDropBehavior() == StatementType.DROP_DEFAULT)
            throw new ReferencedSchemaException(schemaName);
        // If the schema isn't used by any existing tables, it has effectively
        // been dropped, so the drop "succeeds".
        else if (dropSchema.getDropBehavior() == StatementType.DROP_CASCADE)
            ddlFunctions.dropSchema(session, schemaName);
    }

    private  SchemaDDL();

}