當前位置: 首頁>>代碼示例>>Java>>正文


Java ServerConnection.execute方法代碼示例

本文整理匯總了Java中com.alibaba.cobar.server.ServerConnection.execute方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerConnection.execute方法的具體用法?Java ServerConnection.execute怎麽用?Java ServerConnection.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.cobar.server.ServerConnection的用法示例。


在下文中一共展示了ServerConnection.execute方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offset) {
    switch (ServerParseShow.parse(stmt, offset)) {
        case ServerParseShow.DATABASES:
            ShowDatabases.response(c);
            break;

        case ServerParseShow.CONNECTION:
            ShowConnection.execute(c);
            break;
        //            case ServerParseShow.DATASOURCES:
        //                // ShowDataSources.response(c);
        //                // break;
        //            case ServerParseShow.COBAR_STATUS:
        //                // ShowCobarStatus.response(c);
        //                // break;
        case ServerParseShow.SLOW:
            ShowSQLSlow.execute(c);
            break;
        case ServerParseShow.PHYSICAL_SLOW:
            ShowPhysicalSQLSlow.execute(c);
            break;
        default:
            c.execute(stmt, ServerParse.SHOW);
    }
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:26,代碼來源:ShowHandler.java

示例2: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offset) {
    switch (ServerParseShow.parse(stmt, offset)) {
    case ServerParseShow.DATABASES:
        ShowDatabases.response(c);
        break;
    case ServerParseShow.DATASOURCES:
        ShowDataSources.response(c);
        break;
    case ServerParseShow.COBAR_STATUS:
        ShowCobarStatus.response(c);
        break;
    case ServerParseShow.COBAR_CLUSTER:
        ShowCobarCluster.response(c);
        break;
    default:
        c.execute(stmt, ServerParse.SHOW);
    }
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:19,代碼來源:ShowHandler.java

示例3: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offset) {
    switch (ServerParseStart.parse(stmt, offset)) {
        case ServerParseStart.TRANSACTION:
            c.writeErrMessage(ErrorCode.ER_UNKNOWN_COM_ERROR, "Unsupported statement");
            break;
        default:
            c.execute(stmt, ServerParse.START);
    }
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:10,代碼來源:StartHandler.java

示例4: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offset) {
    switch (ServerParseStart.parse(stmt, offset)) {
    case ServerParseStart.TRANSACTION:
        c.writeErrMessage(ErrorCode.ER_UNKNOWN_COM_ERROR, "Unsupported statement");
        break;
    default:
        c.execute(stmt, ServerParse.START);
    }
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:10,代碼來源:StartHandler.java

示例5: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offset) {
    int rs = ServerParseSet.parse(stmt, offset);
    switch (rs & 0xff) {
        case AUTOCOMMIT_ON:
            if (!c.isAutocommit()) {
                c.setAutocommit(true);
            }

            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            break;
        case AUTOCOMMIT_OFF: {
            if (c.isAutocommit()) {
                c.setAutocommit(false);
            }
            c.write(c.writeToBuffer(AC_OFF, c.allocate()));
            break;
        }
        case TX_READ_UNCOMMITTED: {
            c.setTxIsolation(Isolations.READ_UNCOMMITTED.getCode());
            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            break;
        }
        case TX_READ_COMMITTED: {
            c.setTxIsolation(Isolations.READ_COMMITTED.getCode());
            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            break;
        }
        case TX_REPEATED_READ: {
            c.setTxIsolation(Isolations.REPEATED_READ.getCode());
            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            break;
        }
        case TX_SERIALIZABLE: {
            c.setTxIsolation(Isolations.SERIALIZABLE.getCode());
            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            break;
        }
        case NAMES:
            String charset = stmt.substring(rs >>> 8).trim();
            if (c.setCharset(charset)) {
                c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
            } else {
                c.writeErrMessage(ErrorCode.ER_UNKNOWN_CHARACTER_SET, "Unknown charset '" + charset + "'");
            }
            break;
        case CHARACTER_SET_CLIENT:
        case CHARACTER_SET_CONNECTION:
        case CHARACTER_SET_RESULTS:
            CharacterSet.response(stmt, c, rs);
            break;
        case SQL_MODE:
            SqlMode.response(stmt, c, rs);
            break;
        case TX_POLICY_1:
            c.setTrxPolicy(ITransactionPolicy.TDDL);
            break;
        // case TX_POLICY_2:
        // c.setTrxPolicy(new Cobar());
        // c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
        // break;
        case TX_POLICY_3:
            c.setTrxPolicy(ITransactionPolicy.ALLOW_READ_CROSS_DB);
            break;
        // case TX_POLICY_4:
        // c.setTrxPolicy(new Corona());
        // c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
        // break;
        case TX_POLICY_5:
            c.setTrxPolicy(ITransactionPolicy.FREE);
            break;
        case AT_VAR:
            c.execute(stmt, ServerParse.SET);
        default:
            StringBuilder s = new StringBuilder();
            logger.warn(s.append(stmt).append(" is not executed").toString());
            c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
    }
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:79,代碼來源:SetHandler.java

示例6: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offs) {
    int offset = offs;
    switch (ServerParseSelect.parse(stmt, offs)) {
        case ServerParseSelect.VERSION_COMMENT:
            SelectVersionComment.response(c);
            break;
        case ServerParseSelect.DATABASE:
            SelectDatabase.response(c);
            break;
        case ServerParseSelect.USER:
            SelectUser.response(c);
            break;
        case ServerParseSelect.VERSION:
            SelectVersion.response(c);
            break;
        case ServerParseSelect.LAST_INSERT_ID:
            // offset = ParseUtil.move(stmt, 0, "select".length());
            loop: for (; offset < stmt.length(); ++offset) {
                switch (stmt.charAt(offset)) {
                    case ' ':
                        continue;
                    case '/':
                    case '#':
                        offset = ParseUtil.comment(stmt, offset);
                        continue;
                    case 'L':
                    case 'l':
                        break loop;
                }
            }
            offset = ServerParseSelect.indexAfterLastInsertIdFunc(stmt, offset);
            offset = ServerParseSelect.skipAs(stmt, offset);
            SelectLastInsertId.response(c, stmt, offset);
            break;
        case ServerParseSelect.IDENTITY:
            // offset = ParseUtil.move(stmt, 0, "select".length());
            loop: for (; offset < stmt.length(); ++offset) {
                switch (stmt.charAt(offset)) {
                    case ' ':
                        continue;
                    case '/':
                    case '#':
                        offset = ParseUtil.comment(stmt, offset);
                        continue;
                    case '@':
                        break loop;
                }
            }
            int indexOfAtAt = offset;
            offset += 2;
            offset = ServerParseSelect.indexAfterIdentity(stmt, offset);
            String orgName = stmt.substring(indexOfAtAt, offset);
            offset = ServerParseSelect.skipAs(stmt, offset);
            SelectIdentity.response(c, stmt, offset, orgName);
            break;
        default:
            c.execute(stmt, ServerParse.SELECT);
    }
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:60,代碼來源:SelectHandler.java

示例7: handle

import com.alibaba.cobar.server.ServerConnection; //導入方法依賴的package包/類
public static void handle(String stmt, ServerConnection c, int offs) {
    int offset = offs;
    switch (ServerParseSelect.parse(stmt, offs)) {
    case ServerParseSelect.VERSION_COMMENT:
        SelectVersionComment.response(c);
        break;
    case ServerParseSelect.DATABASE:
        SelectDatabase.response(c);
        break;
    case ServerParseSelect.USER:
        SelectUser.response(c);
        break;
    case ServerParseSelect.VERSION:
        SelectVersion.response(c);
        break;
    case ServerParseSelect.LAST_INSERT_ID:
        // offset = ParseUtil.move(stmt, 0, "select".length());
        loop: for (; offset < stmt.length(); ++offset) {
            switch (stmt.charAt(offset)) {
            case ' ':
                continue;
            case '/':
            case '#':
                offset = ParseUtil.comment(stmt, offset);
                continue;
            case 'L':
            case 'l':
                break loop;
            }
        }
        offset = ServerParseSelect.indexAfterLastInsertIdFunc(stmt, offset);
        offset = ServerParseSelect.skipAs(stmt, offset);
        SelectLastInsertId.response(c, stmt, offset);
        break;
    case ServerParseSelect.IDENTITY:
        // offset = ParseUtil.move(stmt, 0, "select".length());
        loop: for (; offset < stmt.length(); ++offset) {
            switch (stmt.charAt(offset)) {
            case ' ':
                continue;
            case '/':
            case '#':
                offset = ParseUtil.comment(stmt, offset);
                continue;
            case '@':
                break loop;
            }
        }
        int indexOfAtAt = offset;
        offset += 2;
        offset = ServerParseSelect.indexAfterIdentity(stmt, offset);
        String orgName = stmt.substring(indexOfAtAt, offset);
        offset = ServerParseSelect.skipAs(stmt, offset);
        SelectIdentity.response(c, stmt, offset, orgName);
        break;
    default:
        c.execute(stmt, ServerParse.SELECT);
    }
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:60,代碼來源:SelectHandler.java


注:本文中的com.alibaba.cobar.server.ServerConnection.execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。