0001: /**
0002: * Sequoia: Database clustering technology.
0003: * Copyright (C) 2002-2004 French National Institute For Research In Computer
0004: * Science And Control (INRIA).
0005: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
0006: * Contact: sequoia@continuent.org
0007: *
0008: * Licensed under the Apache License, Version 2.0 (the "License");
0009: * you may not use this file except in compliance with the License.
0010: * You may obtain a copy of the License at
0011: *
0012: * http://www.apache.org/licenses/LICENSE-2.0
0013: *
0014: * Unless required by applicable law or agreed to in writing, software
0015: * distributed under the License is distributed on an "AS IS" BASIS,
0016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017: * See the License for the specific language governing permissions and
0018: * limitations under the License.
0019: *
0020: * Initial developer(s): Emmanuel Cecchet.
0021: * Contributor(s): Nicolas Modrzyk, Marc Herbert, Jean-Bernard van Zuylen
0022: */package org.continuent.sequoia.common.protocol;
0023:
0024: /*
0025: * TODO: replace <br>~argument by @argument etc. and implement the
0026: * corresponding taglet. An interesting alternative is to dedicate a new "RPC"
0027: * class with exactly one method per command. This class would be a subset of
0028: * today's Connection class. We could then use standard @param and @return tags
0029: * instead of custom tags.
0030: */
0031:
0032: /**
0033: * Protocol commands between Sequoia driver (client) and controller (server).
0034: * All communications follow a classic RPC scheme: the driver sends a Command
0035: * code, followed by argument(s) for some of the commands, and expects some
0036: * answer(s), at the very least an error code or an exception. The server is
0037: * event-driven; communications are inited by the client which is the one
0038: * sending Protocol commands, so the verbs <cite>send</cite> and <cite>receive</cite>
0039: * must be understood as from driver point of view. Almost all these commands
0040: * are put on the wire by client class
0041: * {@link org.continuent.sequoia.driver.Connection} and read (and answered) by
0042: * class {@link
0043: * org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#run()}.
0044: * The only exceptions are the following commands: <br>- ProtocolVersion<br>
0045: * read only by {@link
0046: * org.continuent.sequoia.controller.core.ControllerWorkerThread#run()}, which
0047: * then constructs the connection and pass it to VirtualDatabaseWorkerThread for
0048: * the rest of the execution of this command. <br>- Close<br>
0049: * in addition to Connection, also sent by
0050: * {@link org.continuent.sequoia.driver.ConnectionClosingThread#closeConnection(org.continuent.sequoia.driver.Connection)}
0051: * <br>- Ping <br>
0052: * no more used, was sent on a dedicated connection and silently received only
0053: * by (again)
0054: * {@link org.continuent.sequoia.controller.core.ControllerWorkerThread#run()}
0055: * <h2>Protocol Data Types</h2>
0056: * <strong>optUTF</strong> is a custom type defined like this:
0057: *
0058: * <pre>
0059: * (boolean false) | (boolean true; UTF somestring)
0060: * </pre>
0061: *
0062: * <h3>Sent types</h3>
0063: * <p>
0064: * Several commands send a SQL query. All SQL queries sent on the wire use the
0065: * same starting pattern, a <em>requestStub</em> defined below and in
0066: * {@link org.continuent.sequoia.controller.requests.AbstractRequest#AbstractRequest(String, boolean, int, String, int)}
0067: * <br>
0068: * <strong>requestStub</strong>
0069: *
0070: * <pre>
0071: * UTF request : SQL query
0072: * boolean EscapeProcessing
0073: * UTF LINE_SEPARATOR
0074: * Int timeout
0075: * boolean autoCommit
0076: * boolean isDriverProcessed
0077: * </pre>
0078: *
0079: * <p>
0080: * Queries that expect a result set (read commands mostly) send immediately
0081: * after the requestStub a <em>subsetLengths</em> parameter, of type: <br>
0082: * <strong>subsetLengths</strong>. See
0083: * {@link org.continuent.sequoia.controller.requests.AbstractRequest#receiveResultSetParams(org.continuent.sequoia.common.stream.DriverBufferedInputStream)}
0084: *
0085: * <pre>
0086: * Int maxRows
0087: * Int fetchSize
0088: * </pre>
0089: *
0090: * <p>
0091: * Depending on some configuration flag/state (shared by driver and controller),
0092: * most query commands add an optional <em>skeleton</em> parameter of type
0093: * optUTF.
0094: * <h3>Received types</h3>
0095: * <p>
0096: * Several commands receive a ResultSet of type: <br>
0097: * <strong>ResultSet</strong>
0098: * {@link org.continuent.sequoia.driver.DriverResultSet#DriverResultSet(org.continuent.sequoia.driver.Connection)}
0099: *
0100: * <pre>
0101: * {@link org.continuent.sequoia.common.protocol.Field Field}[] fields
0102: * {@link org.continuent.sequoia.common.protocol.TypeTag}[] java column types
0103: * ArrayList data
0104: * optUTF hasMoreData: cursor name
0105: * </pre> - <em>fields</em> is the description of the ResultSet columns. <br>-
0106: * <em>data</em> is the actual data of the ResultSet. Each element of this
0107: * list is an Object array holding one row of the ResultSet. The whole arraylist
0108: * is serialized using standard Java serialization/readUnshared().
0109: * <h3>Exceptions</h3>
0110: * For almost every command sent, the driver checks if the reply is an exception
0111: * serialized by the controller instead of the regular reply type. Most
0112: * exceptions are put on the wire by
0113: * {@link org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#run()}
0114: * TODO: finish the classification below. <br>
0115: * Exception reply recognized by the driver in: <br>
0116: * FetchNextResultSetRows, closeRemoteResultSet, RestoreConnectionState,
0117: * setAutoCommit, getCatalog, getCatalogs, setCatalog,
0118: * getControllerVersionNumber, DatabaseMetaDataGetTables,
0119: * DatabaseMetaDataGetColumns, DatabaseMetaDataGetPrimaryKeys,
0120: * DatabaseMetaDataGetProcedureColumns, DatabaseMetaDataGetTableTypes,
0121: * DatabaseMetaDataGetTablePrivileges, DatabaseMetaDataGetSchemas,
0122: * DatabaseMetaDataGetDatabaseProductName, DatabaseStaticMetadata <br>
0123: * Exception reply ignored by the driver in: Close, Reset <br>
0124: * Exceptions catched by instanceof(catch-all) default clause in: <br>
0125: * setAutoCommit, <br>
0126: * Commands not implemented at all by the driver: <br>
0127: * GetVirtualDatabaseName, <br>
0128: * TODO: <br>- exceptions and the server side (VirtualDatabaseWorkerThread)
0129: * <br>- double-check arguments and replies <br>- better topic ordering
0130: *
0131: * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
0132: * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
0133: * @author <a href="mailto:Marc.Herbert@emicnetworks.com">Marc Herbert </a>
0134: * @author <a href="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
0135: * </a>
0136: * @version 1.0
0137: */
0138:
0139: public class Commands {
0140: /** "Controller Ready" magic number. */
0141: public static final int ControllerPrompt = 0x1FA1501F;
0142: /** Command prefix sent before each command */
0143: public static final int CommandPrefix = 0xB015CA;
0144:
0145: /**
0146: * ALL commands are used ONLY by classes:
0147: * {@link org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread}
0148: * and {@link org.continuent.sequoia.driver.Connection}
0149: * <p>
0150: * EXCEPT constant ProtocolVersion which is used ONLY by
0151: * {@link org.continuent.sequoia.controller.core.ControllerWorkerThread} and
0152: * constant Ping which is not used anymore. These constants do NOT collide
0153: * with the rest.
0154: */
0155:
0156: /**
0157: * Command used to create a new connection, while checking that driver and
0158: * controller are compatible with each other.
0159: * <p>
0160: * ~commandcode {@value}
0161: * <p>
0162: * <br>
0163: * ~argument UTF dataBaseName<br>
0164: * ~argument UTF user <br>
0165: * ~argument UTF password
0166: * <p>
0167: * ~reply true | (false + failure message (vdb not found)) <br>
0168: * ~reply true | (false + failure message (authentication error)) <br>
0169: * <p>
0170: * ~argument UTF lineSeparator<br>
0171: * ~argument boolean persistentConnection<br>
0172: * <p>
0173: * ~if persistentConnection true<br>
0174: * ~reply false if no connection is available on the cluster | (true +
0175: * persistentConnectionId) <br>
0176: *
0177: * @see org.continuent.sequoia.controller.core.ControllerWorkerThread#run()
0178: * @see org.continuent.sequoia.driver.ConnectionClosingThread#closeConnection(org.continuent.sequoia.driver.Connection)
0179: */
0180: public static final int ProtocolVersion = (8 /* major */<< 16) + 11 /* minor */;
0181:
0182: /**
0183: * Return the major version number of a protocol
0184: *
0185: * @param protocolVersion the protocol version number to extract the major
0186: * from
0187: * @return the protocol major version number
0188: */
0189: public static final int getProtocolMajorVersion(int protocolVersion) {
0190: return protocolVersion >>> 16;
0191: }
0192:
0193: /**
0194: * Return the minor version number of a protocol
0195: *
0196: * @param protocolVersion the protocol version number to extract the minor
0197: * from
0198: * @return the protocol minor version number
0199: */
0200: public static final int getProtocolMinorVersion(int protocolVersion) {
0201: return protocolVersion & 0xFFFF;
0202: }
0203:
0204: /**
0205: * Ping was used by the ControllerPingThread to check if a controller is back
0206: * online after a failure. Since the new ping mechanism, this command is not
0207: * used anymore. It is kept for backward compatibility and for future needs
0208: */
0209: public static final int Ping = -1;
0210:
0211: /**
0212: * Performs a read request and returns the reply.
0213: * <p>
0214: * ~commandcode {@value}
0215: * <p>
0216: * <br>
0217: * ~argument Int
0218: * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
0219: * ~argument requestStub <br>
0220: * ~argument subsetLengths <br>
0221: * ~argument optUTF cursorname <br>
0222: * ~argument optUTF skeleton
0223: * <p>
0224: * <br>
0225: * ~reply ResultSet
0226: *
0227: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteQuery(org.continuent.sequoia.controller.requests.SelectRequest)
0228: */
0229: public static final int StatementExecuteQuery = 0;
0230:
0231: /**
0232: * Performs a write request and returns the number of rows affected.
0233: * <p>
0234: * ~commandcode {@value}
0235: * <p>
0236: * <br>
0237: * ~argument Int
0238: * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
0239: * ~argument requestStub <br>
0240: * ~argument optUTF skeleton
0241: * <p>
0242: * <br>
0243: * ~reply request id (long) <br>
0244: * ~reply nbRows (int)
0245: *
0246: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteUpdate(org.continuent.sequoia.controller.requests.AbstractWriteRequest)
0247: */
0248: public static final int StatementExecuteUpdate = 1;
0249:
0250: /**
0251: * Performs a write request and returns the auto generated keys.
0252: * <p>
0253: * ~commandcode {@value}
0254: * <p>
0255: * <br>
0256: * ~argument Int
0257: * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
0258: * ~argument requestStub <br>
0259: * ~argument subsetLengths <br>
0260: * ~argument optUTF skeleton
0261: * <p>
0262: * <br>
0263: * ~reply request id (long) <br>
0264: * ~reply nbRows <br>
0265: * ~reply ResultSet
0266: *
0267: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteUpdateWithKeys()
0268: */
0269: public static final int StatementExecuteUpdateWithKeys = 2;
0270:
0271: /**
0272: * Calls a stored procedure and returns the reply (ResultSet).
0273: * <p>
0274: * ~commandcode {@value}
0275: * <p>
0276: * <br>
0277: * ~argument requestStub <br>
0278: * ~argument subsetLengths <br>
0279: * ~argument optUTF skeleton
0280: * <p>
0281: * <br>
0282: * ~reply request id (long)<br>
0283: * ~reply ResultSet
0284: *
0285: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
0286: * @deprecated since 2.7
0287: */
0288: public static final int CallableStatementExecuteQuery = 3;
0289:
0290: /**
0291: * Calls a stored procedure and returns the number of rows affected (write
0292: * query).
0293: * <p>
0294: * ~commandcode {@value}
0295: * <p>
0296: * <br>
0297: * ~argument requestStub <br>
0298: * ~argument optUTF skeleton
0299: * <p>
0300: * <br>
0301: * ~reply long request id <br>
0302: * ~reply int nbRows
0303: *
0304: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
0305: * @deprecated since 2.7
0306: */
0307: public static final int CallableStatementExecuteUpdate = 4;
0308:
0309: /**
0310: * Calls a stored procedure using CallableStatement.execute(). This returns an
0311: * arbitrary number of update counts and ResultSets
0312: * <p>
0313: * ~commandcode {@value}
0314: * <p>
0315: * <br>
0316: * ~argument requestStub <br>
0317: * ~argument optUTF skeleton
0318: * <p>
0319: * <br>
0320: * ~reply long request id <br>
0321: * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
0322: * follows)<br>
0323: * ~reply Int nbRows (-1 if no more results)<br>
0324: * ~reply ResultSet
0325: *
0326: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecute(org.continuent.sequoia.controller.requests.StoredProcedure)
0327: * @deprecated since 2.7
0328: */
0329: public static final int CallableStatementExecute = 5;
0330:
0331: /**
0332: * Execute a request using Statement.execute(). This returns an arbitrary
0333: * number of update counts and ResultSets
0334: * <p>
0335: * ~commandcode {@value}
0336: * <p>
0337: * <br>
0338: * ~argument requestStub <br>
0339: * ~argument optUTF skeleton
0340: * <p>
0341: * <br>
0342: * ~reply long request id <br>
0343: * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
0344: * follows) <br>
0345: * ~reply Int nbRows (-1 if no more results) <br>
0346: * ~reply ResultSet
0347: *
0348: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#statementExecute(org.continuent.sequoia.controller.requests.AbstractRequest)
0349: */
0350: public static final int StatementExecute = 6;
0351:
0352: /**
0353: * Calls a stored procedure with IN/OUT and/or named parameters and returns
0354: * the reply (ResultSet, OUT parameters, named parameters objects).
0355: * <p>
0356: * ~commandcode {@value}
0357: * <p>
0358: * <br>
0359: * ~argument requestStub <br>
0360: * ~argument subsetLengths <br>
0361: * ~argument optUTF skeleton
0362: * <p>
0363: * <br>
0364: * ~reply request id (long)<br>
0365: * ~reply ResultSet<br>
0366: * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
0367: * ~reply Object OUT parameter value (if index != 0)<br>
0368: * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
0369: * ~reply Object named parameter value (if name != "0")<br>
0370: *
0371: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
0372: */
0373: public static final int CallableStatementExecuteQueryWithParameters = 7;
0374:
0375: /**
0376: * Calls a stored procedure and returns the number of rows affected (write
0377: * query).
0378: * <p>
0379: * ~commandcode {@value}
0380: * <p>
0381: * <br>
0382: * ~argument requestStub <br>
0383: * ~argument optUTF skeleton
0384: * <p>
0385: * <br>
0386: * ~reply long request id <br>
0387: * ~reply int nbRows (update count) <br>
0388: * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
0389: * ~reply Object OUT parameter value (if index != 0)<br>
0390: * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
0391: * ~reply Object named parameter value (if name != "0")<br>
0392: *
0393: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
0394: */
0395: public static final int CallableStatementExecuteUpdateWithParameters = 8;
0396:
0397: /**
0398: * Calls a stored procedure using CallableStatement.execute(). This returns an
0399: * arbitrary number of update counts and ResultSets
0400: * <p>
0401: * ~commandcode {@value}
0402: * <p>
0403: * <br>
0404: * ~argument requestStub <br>
0405: * ~argument optUTF skeleton
0406: * <p>
0407: * <br>
0408: * ~reply long request id <br>
0409: * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
0410: * follows) <br>
0411: * ~reply Int nbRows (-1 if no more results)<br>
0412: * ~reply ResultSet<br>
0413: * Once all results have been fetched, we fetch OUT and named parameters as
0414: * follows:<br>
0415: * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
0416: * ~reply Object OUT parameter value (if index != 0)<br>
0417: * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
0418: * ~reply Object named parameter value (if name != "0")<br>
0419: *
0420: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecute(org.continuent.sequoia.controller.requests.StoredProcedure)
0421: */
0422: public static final int CallableStatementExecuteWithParameters = 9;
0423:
0424: /*
0425: * Failover commands
0426: */
0427:
0428: /**
0429: * Try to retrieve the result of a previouly executed query using
0430: * executeQuery().
0431: * <p>
0432: * ~commandcode {@value}
0433: * <p>
0434: * <br>
0435: * ~argument long request id
0436: * <p>
0437: * <br>
0438: * ~reply ResultSet (or null)
0439: */
0440: public static final int RetrieveExecuteQueryResult = 10;
0441:
0442: /**
0443: * Try to retrieve the result of a previouly executed query.
0444: * <p>
0445: * ~commandcode {@value}
0446: * <p>
0447: * <br>
0448: * ~argument long request id
0449: * <p>
0450: * <br>
0451: * ~reply int nbRows (-1 if no result has been found)
0452: */
0453: public static final int RetrieveExecuteUpdateResult = 11;
0454:
0455: /**
0456: * Try to retrieve the result of a previouly executed query.
0457: * <p>
0458: * ~commandcode {@value}
0459: * <p>
0460: * <br>
0461: * ~argument long request id
0462: * <p>
0463: * <br>
0464: * ~reply null if no result was found <br>
0465: * ~reply long request id <br>
0466: * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
0467: * follows) <br>
0468: * ~reply Int nbRows (-1 if no more results) <br>
0469: * ~reply ResultSet
0470: */
0471: public static final int RetrieveExecuteResult = 12;
0472:
0473: /**
0474: * Try to retrieve the result of a previouly executed query.
0475: * <p>
0476: * ~commandcode {@value}
0477: * <p>
0478: * <br>
0479: * ~argument long request id
0480: * <p>
0481: * <br>
0482: * ~reply int nbRows (-1 if no result has been found) <br>
0483: * ~reply ResultSet (if nbRows was != -1)
0484: */
0485: public static final int RetrieveExecuteUpdateWithKeysResult = 13;
0486:
0487: /**
0488: * Try to retrieve the result of a previouly executed commit. If the commit
0489: * was not executed before, the controller will execute it and return the
0490: * result which is the transaction id acknowledgement.
0491: * <p>
0492: * ~commandcode {@value}
0493: * <p>
0494: * <br>
0495: * ~reply Long transactionId: id of commited transaction
0496: */
0497: public static final int RetrieveCommitResult = 14;
0498:
0499: /**
0500: * Try to retrieve the result of a previouly executed rollback. If the
0501: * rollback was not executed before, the controller will execute it and return
0502: * the result which is the transaction id acknowledgement.
0503: * <p>
0504: * ~commandcode {@value}
0505: * <p>
0506: * <br>
0507: * ~reply Long transactionId: id of rollbacked transaction
0508: */
0509: public static final int RetrieveRollbackResult = 15;
0510:
0511: /**
0512: * Try to retrieve the result of a previouly executed stored procedure with
0513: * IN/OUT and/or named parameters using executeQuery().
0514: * <p>
0515: * ~commandcode {@value}
0516: * <p>
0517: * <br>
0518: * ~argument long request id
0519: * <p>
0520: * <br>
0521: * ~reply ResultSet (or null) ~reply int number of OUT parameters<br>
0522: * ~reply Object OUT parameter values (nb of times indicated above)<br>
0523: * ~reply int number of named parameters<br>
0524: * ~reply String parameter name<br>
0525: * ~reply Object named parameter value (nb of times indicated above)<br>
0526: */
0527: public static final int RetrieveExecuteQueryResultWithParameters = 16;
0528:
0529: /**
0530: * Try to retrieve the result of a previouly executed stored procedure with
0531: * IN/OUT and/or named parameters.
0532: * <p>
0533: * ~commandcode {@value}
0534: * <p>
0535: * <br>
0536: * ~argument long request id
0537: * <p>
0538: * <br>
0539: * ~reply int nbRows (-1 if no result has been found) ~reply int number of OUT
0540: * parameters<br>
0541: * ~reply Object OUT parameter values (nb of times indicated above)<br>
0542: * ~reply int number of named parameters<br>
0543: * ~reply String parameter name<br>
0544: * ~reply Object named parameter value (nb of times indicated above)<br>
0545: */
0546: public static final int RetrieveExecuteUpdateResultWithParameters = 17;
0547:
0548: /**
0549: * Try to retrieve the result of a previouly executed stored procedure with
0550: * IN/OUT and/or named parameters.
0551: * <p>
0552: * ~commandcode {@value}
0553: * <p>
0554: * <br>
0555: * ~argument long request id
0556: * <p>
0557: * <br>
0558: * ~reply null if no result was found <br>
0559: * ~reply long request id <br>
0560: * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
0561: * follows) <br>
0562: * ~reply Int nbRows (-1 if no more results) <br>
0563: * ~reply ResultSet<br>
0564: * Once all results have been fetched, we fetch OUT and named parameters as
0565: * follows:<br>
0566: * ~reply int number of OUT parameters<br>
0567: * ~reply Object OUT parameter values (nb of times indicated above)<br>
0568: * ~reply int number of named parameters<br>
0569: * ~reply String parameter name<br>
0570: * ~reply Object named parameter value (nb of times indicated above)<br>
0571: */
0572: public static final int RetrieveExecuteResultWithParameters = 18;
0573:
0574: /**
0575: * Begins a new transaction and returns the corresponding transaction
0576: * identifier. This method is called from the driver when
0577: * {@link org.continuent.sequoia.driver.Connection#setAutoCommit(boolean)}is
0578: * called with <code>false</code> argument.
0579: * <p>
0580: * ~commandcode {@value}
0581: * <p>
0582: * <br>
0583: * ~reply Long transactionId
0584: *
0585: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#begin(String,
0586: * boolean, long)
0587: */
0588: public static final int Begin = 20;
0589:
0590: /**
0591: * Commits the current transaction.
0592: * <p>
0593: * ~commandcode {@value}
0594: * <p>
0595: * <br>
0596: * ~reply Long transactionId: id of commited transaction
0597: *
0598: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#commit(long,
0599: * boolean, boolean)
0600: */
0601: public static final int Commit = 21;
0602:
0603: /**
0604: * Rollbacks the current transaction.
0605: * <p>
0606: * ~commandcode {@value}
0607: * <p>
0608: * <br>
0609: * ~reply Long transactionId: id of rollbacked transaction
0610: *
0611: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#rollback(long,
0612: * boolean)
0613: */
0614: public static final int Rollback = 22;
0615:
0616: /**
0617: * Sets a named savepoint to a transaction given its id
0618: *
0619: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#setSavepoint(long,
0620: * String)
0621: */
0622: public static final int SetNamedSavepoint = 23;
0623:
0624: /**
0625: * Sets a unnamed savepoint to a transaction given its id
0626: *
0627: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#setSavepoint(long)
0628: */
0629: public static final int SetUnnamedSavepoint = 24;
0630:
0631: /**
0632: * Releases a savepoint from a transaction given its id
0633: *
0634: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#releaseSavepoint(long,
0635: * String)
0636: */
0637: public static final int ReleaseSavepoint = 25;
0638:
0639: /**
0640: * Rollbacks the current transaction back to the given savepoint
0641: *
0642: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#rollbackToSavepoint()
0643: */
0644: public static final int RollbackToSavepoint = 26;
0645:
0646: /*
0647: * Connection management
0648: */
0649:
0650: /**
0651: * Close the connection. The controller replies a CommandCompleted
0652: * SequoiaException, ignored by the driver.
0653: * <p>
0654: * ~commandcode {@value}
0655: * <p>
0656: * <br>
0657: * ~reply <anything>
0658: */
0659: public static final int Close = 30;
0660:
0661: /**
0662: * Reset the connection.
0663: * <p>
0664: * ~commandcode {@value}
0665: */
0666: public static final int Reset = 31;
0667:
0668: /**
0669: * Fetch next rows of data for ResultSet streaming.
0670: * <p>
0671: * ~commandcode {@value}
0672: * <p>
0673: * <br>
0674: * ~argument UTF cursorName <br>
0675: * ~argument Int fetchSize
0676: * <p>
0677: * <br>
0678: * ~reply ArrayList data <br>
0679: * ~reply boolean hasMoreData
0680: */
0681: public static final int FetchNextResultSetRows = 32;
0682:
0683: /**
0684: * Closes a remote ResultSet that was opened for streaming.
0685: * <p>
0686: * ~commandcode {@value}
0687: * <p>
0688: * <br>
0689: * ~argument UTF cursorName
0690: * <p>
0691: * <br>
0692: * ~reply SequoiaException CommandCompleted
0693: */
0694: public static final int CloseRemoteResultSet = 33;
0695:
0696: /**
0697: * Restore a connection state after an automatic reconnection. Tell the
0698: * controller if we were in autoCommit mode (i.e.: a transaction was
0699: * <em>not</em> started), and if we were not then give the current
0700: * transactionId. Warning: this is not an optUTF type at all.
0701: * <p>
0702: * ~commandcode {@value}
0703: * <p>
0704: * <br>
0705: * ~argument boolean writeExecutedInTransaction<br>
0706: * ~argument (boolean true) | (boolean false; Long transactionId) <br>
0707: * ~argument (boolean false) | (boolean true; persistentConnectionId) <br>
0708: */
0709: public static final int RestoreConnectionState = 34;
0710:
0711: /**
0712: * Retrieve the catalog (database) we are connected to.
0713: * <p>
0714: * ~commandcode {@value}
0715: * <p>
0716: * <br>
0717: * ~reply String vdbName
0718: *
0719: * @see org.continuent.sequoia.driver.Connection#getCatalog()
0720: */
0721: public static final int ConnectionGetCatalog = 36;
0722:
0723: /**
0724: * Retrieve the list of available catalogs (databases).
0725: * <p>
0726: * ~commandcode {@value}
0727: * <p>
0728: * <br>
0729: * ~reply ResultSet virtualDatabasesList
0730: *
0731: * @see org.continuent.sequoia.driver.Connection#getCatalogs()
0732: */
0733: public static final int ConnectionGetCatalogs = 37;
0734:
0735: /**
0736: * Connect to another catalog/database (as the same user).
0737: * <p>
0738: * ~commandcode {@value}
0739: * <p>
0740: * <br>
0741: * ~argument UTF catalog
0742: * <p>
0743: * <br>
0744: * ~reply boolean isValidCatalog
0745: *
0746: * @see org.continuent.sequoia.driver.Connection#setCatalog(String)
0747: */
0748: public static final int ConnectionSetCatalog = 38;
0749:
0750: /**
0751: * Set the new transaction isolation level to use for this connection.
0752: * <p>
0753: * ~commandcode {@value}
0754: * <p>
0755: * <br>
0756: * ~argument int transaction isolation level
0757: * <p>
0758: * <br>
0759: * ~reply boolean true (meaning: not an exception)
0760: *
0761: * @see org.continuent.sequoia.driver.Connection#setTransactionIsolation(int)
0762: */
0763: public static final int SetTransactionIsolation = 39;
0764:
0765: /**
0766: * Retrieves the SQLWarning chain associated to a persistent connection to a
0767: * backend.
0768: * <p>
0769: * ~commandcode {@value}<br>
0770: * ~argument int persistent connection id
0771: * <p>
0772: * <br>
0773: * ~reply BackendDriverException SQLWarning chain wrapped into a bde
0774: *
0775: * @see org.continuent.sequoia.driver.Connection#getWarnings()
0776: */
0777: public static final int ConnectionGetWarnings = 40;
0778:
0779: /**
0780: * Clears the SQLWarning chain associated to a persistent connection
0781: * <p>
0782: * ~commandcode {@value}<br>
0783: * ~argument int persistent connection id
0784: * <p>
0785: * <br>
0786: * ~reply boolean true (meaning: not an exception)
0787: *
0788: * @see org.continuent.sequoia.driver.Connection#clearWarnings()
0789: */
0790: public static final int ConnectionClearWarnings = 41;
0791:
0792: /**
0793: * Set the connection readonly status.
0794: * <p>
0795: * ~commandcode {@value}
0796: * <p>
0797: * <br>
0798: * ~argument boolean readOnly value
0799: * <p>
0800: * <br>
0801: * ~reply boolean true (meaning: not an exception)
0802: *
0803: * @see org.continuent.sequoia.driver.Connection#setReadOnly(boolean)
0804: */
0805: public static final int SetReadOnly = 42;
0806:
0807: /*
0808: * MetaData functions
0809: */
0810:
0811: /**
0812: * Gets the virtual database name to be used by the client (Sequoia driver).
0813: * It currently returns the same result as ConnectionGetCatalog(). It is
0814: * currently never used by the driver.
0815: * <p>
0816: * ~commandcode {@value}
0817: * <p>
0818: * <br>
0819: * ~reply String dbName
0820: *
0821: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#getVirtualDatabaseName()
0822: */
0823: public static final int GetVirtualDatabaseName = 50;
0824:
0825: /**
0826: * Gets the controller version number.
0827: * <p>
0828: * ~commandcode {@value}
0829: * <p>
0830: * <br>
0831: * ~reply String controllerVersion
0832: *
0833: * @see org.continuent.sequoia.controller.core.Controller#getVersionNumber()
0834: */
0835: public static final int GetControllerVersionNumber = 51;
0836:
0837: /**
0838: * Used to get the schema tables by calling DatabaseMetaData.getTables().
0839: * <p>
0840: * ~commandcode {@value}
0841: * <p>
0842: * <br>
0843: * ~argument UTF catalog <br>
0844: * ~argument UTF schemaPattern <br>
0845: * ~argument UTF tableNamePattern <br>
0846: * ~argument String[] types
0847: * <p>
0848: * <br>
0849: * ~reply ResultSet tables
0850: *
0851: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTables()
0852: */
0853: public static final int DatabaseMetaDataGetTables = 52;
0854:
0855: /**
0856: * Used to get the schema columns by calling DatabaseMetaData.getColumns().
0857: * <p>
0858: * ~commandcode {@value}
0859: * <p>
0860: * <br>
0861: * ~argument UTF catalog <br>
0862: * ~argument UTF schemaPattern <br>
0863: * ~argument UTF tableNamePattern <br>
0864: * ~argument UTF columnNamePattern
0865: * <p>
0866: * <br>
0867: * ~reply ResultSet schemaColumns
0868: *
0869: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetColumns()
0870: */
0871: public static final int DatabaseMetaDataGetColumns = 53;
0872:
0873: /**
0874: * Used to get the schema primary keys by calling
0875: * DatabaseMetaData.getColumns().
0876: * <p>
0877: * ~commandcode {@value}
0878: * <p>
0879: * <br>
0880: * ~argument UTF catalog <br>
0881: * ~argument UTF schemaPattern <br>
0882: * ~argument UTF tableNamePattern
0883: * <p>
0884: * <br>
0885: * ~reply ResultSet pKeys
0886: *
0887: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetPrimaryKeys()
0888: */
0889: public static final int DatabaseMetaDataGetPrimaryKeys = 54;
0890:
0891: /**
0892: * Used to get the schema procedures by calling
0893: * DatabaseMetaData.getProcedures().
0894: * <p>
0895: * ~commandcode {@value}
0896: * <p>
0897: * <br>
0898: * ~argument UTF catalog <br>
0899: * ~argument UTF schemaPattern <br>
0900: * ~argument UTF procedureNamePattern
0901: * <p>
0902: * <br>
0903: * ~reply ResultSet procedures
0904: *
0905: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetProcedures()
0906: */
0907: public static final int DatabaseMetaDataGetProcedures = 55;
0908:
0909: /**
0910: * Used to get the schema procedure columns by calling
0911: * DatabaseMetaData.getProcedureColumns().
0912: * <p>
0913: * ~commandcode {@value}
0914: * <p>
0915: * <br>
0916: * ~argument UTF catalog <br>
0917: * ~argument UTF schemaPattern <br>
0918: * ~argument UTF procedureNamePattern <br>
0919: * ~argument UTF columnNamePattern
0920: * <p>
0921: * <br>
0922: * ~reply ResultSet procColumns
0923: *
0924: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetProcedureColumns()
0925: */
0926: public static final int DatabaseMetaDataGetProcedureColumns = 56;
0927:
0928: /**
0929: * Retrieve the database table types.
0930: * <p>
0931: * ~commandcode {@value}
0932: * <p>
0933: * <br>
0934: * ~reply ResultSet tableTypes
0935: *
0936: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTableTypes()
0937: */
0938: public static final int DatabaseMetaDataGetTableTypes = 58;
0939:
0940: /**
0941: * Retrieve the table privileges.
0942: * <p>
0943: * ~commandcode {@value}
0944: * <p>
0945: * <br>
0946: * ~argument UTF catalog <br>
0947: * ~argument UTF schemaPattern <br>
0948: * ~argument UTF tableNamePattern
0949: * <p>
0950: * <br>
0951: * ~reply ResultSet accessRights
0952: *
0953: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTablePrivileges()
0954: */
0955: public static final int DatabaseMetaDataGetTablePrivileges = 59;
0956:
0957: /**
0958: * Retrieve the schemas.
0959: * <p>
0960: * ~commandcode {@value}
0961: * <p>
0962: * <br>
0963: * ~reply ResultSet schemas
0964: *
0965: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSchemas()
0966: */
0967: public static final int DatabaseMetaDataGetSchemas = 60;
0968:
0969: /**
0970: * Retrieve the database product name.
0971: * <p>
0972: * ~commandcode {@value}
0973: * <p>
0974: * <br>
0975: * ~reply String productName
0976: *
0977: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetDatabaseProductName()
0978: */
0979: public static final int DatabaseMetaDataGetDatabaseProductName = 61;
0980:
0981: /**
0982: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetAttributes()
0983: */
0984: public static final int DatabaseMetaDataGetAttributes = 62;
0985:
0986: /**
0987: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetBestRowIdentifier()
0988: */
0989: public static final int DatabaseMetaDataGetBestRowIdentifier = 63;
0990:
0991: /**
0992: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetColumnPrivileges()
0993: */
0994: public static final int DatabaseMetaDataGetColumnPrivileges = 64;
0995:
0996: /**
0997: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetCrossReference()
0998: */
0999: public static final int DatabaseMetaDataGetCrossReference = 65;
1000:
1001: /**
1002: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetExportedKeys()
1003: */
1004: public static final int DatabaseMetaDataGetExportedKeys = 66;
1005:
1006: /**
1007: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetImportedKeys()
1008: */
1009: public static final int DatabaseMetaDataGetImportedKeys = 67;
1010:
1011: /**
1012: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetIndexInfo()
1013: */
1014: public static final int DatabaseMetaDataGetIndexInfo = 68;
1015:
1016: /**
1017: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSuperTables()
1018: */
1019: public static final int DatabaseMetaDataGetSuperTables = 69;
1020:
1021: /**
1022: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSuperTypes()
1023: */
1024: public static final int DatabaseMetaDataGetSuperTypes = 70;
1025:
1026: /**
1027: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTypeInfo()
1028: */
1029: public static final int DatabaseMetaDataGetTypeInfo = 71;
1030:
1031: /**
1032: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetUDTs()
1033: */
1034: public static final int DatabaseMetaDataGetUDTs = 72;
1035:
1036: /**
1037: * @see java.sql.DatabaseMetaData#getVersionColumns(java.lang.String,
1038: * java.lang.String, java.lang.String)
1039: */
1040: public static final int DatabaseMetaDataGetVersionColumns = 73;
1041:
1042: /**
1043: * Retrieve one value from the virtual database metadata.
1044: * <p>
1045: * ~commandcode {@value}
1046: * <p>
1047: * <br>
1048: * ~argument UTF: serialized DatabaseMetaData method call.
1049: * <p>
1050: * <br>
1051: * ~reply Integer|Boolean|String|other ? value
1052: *
1053: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseStaticMetadata()
1054: */
1055: public static final int DatabaseStaticMetadata = 80;
1056:
1057: /**
1058: * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#preparedStatementGetMetaData()
1059: */
1060: public static final int PreparedStatementGetMetaData = 81;
1061:
1062: /**
1063: * Try to retrieve the result of a previouly executed release savepoint using
1064: * releaseSavepoint().
1065: * <p>
1066: * ~commandcode {@value}
1067: * <p>
1068: * <br>
1069: * ~argument String savepoint name
1070: * <p>
1071: * <br>
1072: * ~reply boolean: true if the savepoint was removed, false if it is still
1073: * there.
1074: */
1075: public static final int RetrieveReleaseSavepoint = 82;
1076:
1077: }
|