Search in sources :

Example 1 with MySQLResultSet

use of io.mycat.prototypeserver.mysql.MySQLResultSet in project Mycat2 by MyCATApache.

the class ShowProcedureStatusSQLHandler method onExecute.

@Override
protected Future<Void> onExecute(SQLRequest<MySqlShowProcedureStatusStatement> request, MycatDataContext dataContext, Response response) {
    List<ColumnDefPacket> columnDefPacketList = getShowProcedureStatusColumns();
    MySQLResultSet mySQLResultSet = MySQLResultSet.create(columnDefPacketList);
    mySQLResultSet.setRows(Collections.emptyList());
    return response.sendResultSet(mySQLResultSet.build());
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) MySQLResultSet(io.mycat.prototypeserver.mysql.MySQLResultSet)

Example 2 with MySQLResultSet

use of io.mycat.prototypeserver.mysql.MySQLResultSet in project Mycat2 by MyCATApache.

the class ShowCreateDatabaseHandler method onExecute.

@Override
protected Future<Void> onExecute(SQLRequest<MySqlShowCreateDatabaseStatement> request, MycatDataContext dataContext, Response response) {
    List<ColumnDefPacket> columnDefPacketList = getShowCreateDatabaseColumns();
    MySQLResultSet mySQLResultSet = MySQLResultSet.create(columnDefPacketList);
    String database = SQLUtils.normalize(request.getAst().getDatabase().toString());
    SQLCreateDatabaseStatement sqlCreateDatabaseStatement = new SQLCreateDatabaseStatement();
    sqlCreateDatabaseStatement.setDatabase(database);
    ArrayList<Object[]> objects = new ArrayList<>();
    objects.add(new Object[] { database, sqlCreateDatabaseStatement.toString() });
    mySQLResultSet.setRows(objects);
    return response.sendResultSet(mySQLResultSet.build());
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) SQLCreateDatabaseStatement(com.alibaba.druid.sql.ast.statement.SQLCreateDatabaseStatement) MySQLResultSet(io.mycat.prototypeserver.mysql.MySQLResultSet) ArrayList(java.util.ArrayList)

Example 3 with MySQLResultSet

use of io.mycat.prototypeserver.mysql.MySQLResultSet in project Mycat2 by MyCATApache.

the class ShowCreateTableSQLHandler method onExecute.

@Override
protected Future<Void> onExecute(SQLRequest<SQLShowCreateTableStatement> request, MycatDataContext dataContext, Response response) {
    SQLShowCreateTableStatement ast = request.getAst();
    SQLName name = ast.getName();
    if (name instanceof SQLIdentifierExpr) {
        SQLPropertyExpr sqlPropertyExpr = new SQLPropertyExpr();
        sqlPropertyExpr.setOwner(dataContext.getDefaultSchema());
        sqlPropertyExpr.setName(name.toString());
        ast.setName(sqlPropertyExpr);
    }
    List<ColumnDefPacket> showCreateTableColumns = PrototypeService.getShowCreateTableColumns();
    MySQLResultSet mySQLResultSet = MySQLResultSet.create(showCreateTableColumns);
    mySQLResultSet.setRows(showCreateTable(ast));
    return response.sendResultSet(mySQLResultSet.build());
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) SQLShowCreateTableStatement(com.alibaba.druid.sql.ast.statement.SQLShowCreateTableStatement) MySQLResultSet(io.mycat.prototypeserver.mysql.MySQLResultSet) SQLName(com.alibaba.druid.sql.ast.SQLName) SQLIdentifierExpr(com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr) SQLPropertyExpr(com.alibaba.druid.sql.ast.expr.SQLPropertyExpr)

Example 4 with MySQLResultSet

use of io.mycat.prototypeserver.mysql.MySQLResultSet in project Mycat2 by MyCATApache.

the class ShowErrorsSQLHandler method onExecute.

@Override
protected Future<Void> onExecute(SQLRequest<MySqlShowErrorsStatement> request, MycatDataContext dataContext, Response response) {
    MySQLResultSet mySQLResultSet = MySQLResultSet.create(PrototypeService.getShowErrorsColumns());
    mySQLResultSet.setRows(Collections.emptyList());
    return response.sendResultSet(mySQLResultSet.build());
}
Also used : MySQLResultSet(io.mycat.prototypeserver.mysql.MySQLResultSet)

Example 5 with MySQLResultSet

use of io.mycat.prototypeserver.mysql.MySQLResultSet in project Mycat2 by MyCATApache.

the class ShowWarningsSQLHandler method onExecute.

@Override
protected Future<Void> onExecute(SQLRequest<MySqlShowWarningsStatement> request, MycatDataContext dataContext, Response response) {
    List<ColumnDefPacket> columnDefPacketList = getShowWarningsColumns();
    MySQLResultSet mySQLResultSet = MySQLResultSet.create(columnDefPacketList);
    mySQLResultSet.setRows(Collections.emptyList());
    return response.sendResultSet(mySQLResultSet.build());
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) MySQLResultSet(io.mycat.prototypeserver.mysql.MySQLResultSet)

Aggregations

MySQLResultSet (io.mycat.prototypeserver.mysql.MySQLResultSet)7 ColumnDefPacket (io.mycat.beans.mysql.packet.ColumnDefPacket)6 SQLName (com.alibaba.druid.sql.ast.SQLName)1 SQLIdentifierExpr (com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr)1 SQLPropertyExpr (com.alibaba.druid.sql.ast.expr.SQLPropertyExpr)1 SQLCreateDatabaseStatement (com.alibaba.druid.sql.ast.statement.SQLCreateDatabaseStatement)1 SQLShowCreateTableStatement (com.alibaba.druid.sql.ast.statement.SQLShowCreateTableStatement)1 ArrayList (java.util.ArrayList)1