Commit 5ef67a1a authored by terrymanu's avatar terrymanu
Browse files

refactor CommandPacket & JDBCBackendHandler.hasMoreResultValue => next

parent bbc78c6b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -37,17 +37,17 @@ public interface BackendHandler {
    CommandResponsePackets execute();
    
    /**
     * Has more Result value.
     * Goto next result value.
     *
     * @return has more result value
     * @throws SQLException sql exception
     * @return has more result value or not
     * @throws SQLException SQL exception
     */
    boolean hasMoreResultValue() throws SQLException;
    boolean next() throws SQLException;
    
    /**
     * Get result value.
     *
     * @return database packet
     * @return database packet of result value
     */
    DatabasePacket getResultValue();
}
+1 −1
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public final class SQLPacketsBackendHandler implements BackendHandler {
    }
    
    @Override
    public boolean hasMoreResultValue() throws SQLException {
    public boolean next() throws SQLException {
        if (null == mergedResult || !mergedResult.next()) {
            for (Entry<String, List<Channel>> entry : channelsMap.entrySet()) {
                for (Channel each : entry.getValue()) {
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public final class JDBCBackendHandler implements BackendHandler {
    }
    
    @Override
    public boolean hasMoreResultValue() throws SQLException {
    public boolean next() throws SQLException {
        if (null == mergedResult || !mergedResult.next()) {
            backendConnection.close();
            return false;
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public final class MySQLFrontendHandler extends FrontendHandler {
                    for (DatabasePacket each : commandPacket.execute().getPackets()) {
                        context.writeAndFlush(each);
                    }
                    while (commandPacket.hasMoreResultValue()) {
                    while (commandPacket.next()) {
                        // TODO try to use wait notify
                        while (!context.channel().isWritable()) {
                            continue;
+4 −4
Original line number Diff line number Diff line
@@ -41,16 +41,16 @@ public abstract class CommandPacket extends MySQLPacket {
    public abstract CommandResponsePackets execute();
    
    /**
     * Has more result value.
     * Goto next result value.
     *
     * @return has more result value
     * @return has more result value or not
     */
    public abstract boolean hasMoreResultValue();
    public abstract boolean next();
    
    /**
     * Get result value.
     *
     * @return result to be sent
     * @return database packet of result value
     */
    public abstract DatabasePacket getResultValue();
}
Loading