当前位置: 首页>>代码示例>>Java>>正文


Java SQLLexer.splitStatements方法代码示例

本文整理汇总了Java中org.voltdb.parser.SQLLexer.splitStatements方法的典型用法代码示例。如果您正苦于以下问题:Java SQLLexer.splitStatements方法的具体用法?Java SQLLexer.splitStatements怎么用?Java SQLLexer.splitStatements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.parser.SQLLexer的用法示例。


在下文中一共展示了SQLLexer.splitStatements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatchAdHocCommon

import org.voltdb.parser.SQLLexer; //导入方法依赖的package包/类
private final void dispatchAdHocCommon(StoredProcedureInvocation task,
        ClientInputHandler handler, Connection ccxn, ExplainMode explainMode,
        String sql, Object[] userParams, Object[] userPartitionKey, AuthSystem.AuthUser user) {
    List<String> sqlStatements = SQLLexer.splitStatements(sql);
    String[] stmtsArray = sqlStatements.toArray(new String[sqlStatements.size()]);

    AdHocPlannerWork ahpw = new AdHocPlannerWork(
            m_siteId,
            task.clientHandle, handler.connectionId(),
            handler.isAdmin(), ccxn,
            sql, stmtsArray, userParams, null, explainMode,
            userPartitionKey == null, userPartitionKey,
            task.procName, task.type, task.originalTxnId, task.originalUniqueId,
            VoltDB.instance().getReplicationRole() == ReplicationRole.REPLICA,
            VoltDB.instance().getCatalogContext().cluster.getUseddlschema(),
            m_adhocCompletionHandler, user);
    LocalObjectMessage work = new LocalObjectMessage( ahpw );

    m_mailbox.send(m_plannerSiteId, work);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:21,代码来源:ClientInterface.java

示例2: checkSplitter

import org.voltdb.parser.SQLLexer; //导入方法依赖的package包/类
private void checkSplitter(final String strIn, final String... strsCmp) {
    final List<String> strsOut = SQLLexer.splitStatements(strIn);
    assertEquals(strsCmp.length, strsOut.size());
    for (int i = 0; i < strsCmp.length; ++i) {
        assertEquals(strsCmp[i], strsOut.get(i));
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:8,代码来源:TestSplitSQLStatements.java

示例3: dispatchExplainProcedure

import org.voltdb.parser.SQLLexer; //导入方法依赖的package包/类
ClientResponseImpl dispatchExplainProcedure(StoredProcedureInvocation task, ClientInputHandler handler, Connection ccxn, AuthUser user) {
    ParameterSet params = task.getParams();
    /*
     * TODO: We don't actually support multiple proc names in an ExplainProc call,
     * so I THINK that the string is always a single procname symbol and all this
     * splitting and iterating is a no-op.
     */
    //String procs = (String) params.toArray()[0];
    List<String> procNames = SQLLexer.splitStatements( (String)params.toArray()[0]);
    int size = procNames.size();
    VoltTable[] vt = new VoltTable[ size ];
    for( int i=0; i<size; i++ ) {
        String procName = procNames.get(i);

        // look in the catalog
        Procedure proc = m_catalogContext.get().procedures.get(procName);
        if (proc == null) {
            // check default procs and send them off to be explained using the regular
            // adhoc explain process
            proc = m_catalogContext.get().m_defaultProcs.checkForDefaultProcedure(procName);
            if (proc != null) {
                String sql = m_catalogContext.get().m_defaultProcs.sqlForDefaultProc(proc);
                dispatchAdHocCommon(task, handler, ccxn, ExplainMode.EXPLAIN_DEFAULT_PROC, sql, new Object[0], null, user);
                return null;
            }

            ClientResponseImpl errorResponse =
                    new ClientResponseImpl(
                            ClientResponseImpl.UNEXPECTED_FAILURE,
                            new VoltTable[0], "Procedure "+procName+" not in catalog",
                            task.clientHandle);
            return errorResponse;
        }

        vt[i] = new VoltTable(new VoltTable.ColumnInfo( "SQL_STATEMENT", VoltType.STRING),
                              new VoltTable.ColumnInfo( "EXECUTION_PLAN", VoltType.STRING));

        for( Statement stmt : proc.getStatements() ) {
            vt[i].addRow( stmt.getSqltext(), Encoder.hexDecodeToString( stmt.getExplainplan() ) );
        }
    }

    ClientResponseImpl response =
            new ClientResponseImpl(
                    ClientResponseImpl.SUCCESS,
                    ClientResponse.UNINITIALIZED_APP_STATUS_CODE,
                    null,
                    vt,
                    null);
    response.setClientHandle( task.clientHandle );
    ByteBuffer buf = ByteBuffer.allocate(response.getSerializedSize() + 4);
    buf.putInt(buf.capacity() - 4);
    response.flattenToBuffer(buf);
    buf.flip();
    ccxn.writeStream().enqueue(buf);
    return null;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:58,代码来源:ClientInterface.java


注:本文中的org.voltdb.parser.SQLLexer.splitStatements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。