class DALBackendHandlerFactory {

    public static TextProtocolBackendHandler newInstance(final String sql, final DALStatement dalStatement, final BackendConnection backendConnection) {
        if (dalStatement instanceof MySQLUseStatement) {
            return new UseDatabaseBackendHandler((MySQLUseStatement) dalStatement, backendConnection);
        }
        if (dalStatement instanceof MySQLShowDatabasesStatement) {
            return new ShowDatabasesBackendHandler(backendConnection);
        }
        if (dalStatement instanceof MySQLShowTablesStatement) {
            return new ShowTablesBackendHandler(sql, dalStatement, backendConnection);
        }
        if (dalStatement instanceof SetStatement) {
            return new BroadcastBackendHandler(sql, dalStatement, backendConnection);
        }
        return new UnicastBackendHandler(sql, dalStatement, backendConnection);
    }

}