KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > protocol > Commands


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Emmanuel Cecchet.
21  * Contributor(s): Nicolas Modrzyk, Marc Herbert, Jean-Bernard van Zuylen
22  */

23
24 package org.continuent.sequoia.common.protocol;
25
26 /*
27  * TODO: replace <br>~argument by @argument etc. and implement the
28  * corresponding taglet. An interesting alternative is to dedicate a new "RPC"
29  * class with exactly one method per command. This class would be a subset of
30  * today's Connection class. We could then use standard @param and @return tags
31  * instead of custom tags.
32  */

33
34 /**
35  * Protocol commands between Sequoia driver (client) and controller (server).
36  * All communications follow a classic RPC scheme: the driver sends a Command
37  * code, followed by argument(s) for some of the commands, and expects some
38  * answer(s), at the very least an error code or an exception. The server is
39  * event-driven; communications are inited by the client which is the one
40  * sending Protocol commands, so the verbs <cite>send</cite> and <cite>receive</cite>
41  * must be understood as from driver point of view. Almost all these commands
42  * are put on the wire by client class
43  * {@link org.continuent.sequoia.driver.Connection} and read (and answered) by
44  * class {@link
45  * org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#run()}.
46  * The only exceptions are the following commands: <br>- ProtocolVersion<br>
47  * read only by {@link
48  * org.continuent.sequoia.controller.core.ControllerWorkerThread#run()}, which
49  * then constructs the connection and pass it to VirtualDatabaseWorkerThread for
50  * the rest of the execution of this command. <br>- Close<br>
51  * in addition to Connection, also sent by
52  * {@link org.continuent.sequoia.driver.ConnectionClosingThread#closeConnection(org.continuent.sequoia.driver.Connection)}
53  * <br>- Ping <br>
54  * sent on a dedicated connection only by {@link
55  * org.continuent.sequoia.driver.connectpolicy.ControllerPingThread#run()} and
56  * silently received only by (again) {@link
57  * org.continuent.sequoia.controller.core.ControllerWorkerThread#run()}
58  * <h2>Protocol Data Types</h2>
59  * <strong>optUTF</strong> is a custom type defined like this:
60  *
61  * <pre>
62  * (boolean false) | (boolean true; UTF somestring)
63  * </pre>
64  *
65  * <h3>Sent types</h3>
66  * <p>
67  * Several commands send a SQL query. All SQL queries sent on the wire use the
68  * same starting pattern, a <em>requestStub</em> defined below and in
69  * {@link org.continuent.sequoia.common.sql.Request#sendToStream(org.continuent.sequoia.common.stream.DriverBufferedOutputStream)}
70  * <br>
71  * <strong>requestStub</strong>
72  *
73  * <pre>
74  * UTF request : SQL query
75  * boolean EscapeProcessing
76  * UTF LINE_SEPARATOR
77  * Int timeout
78  * boolean autoCommit
79  * boolean isDriverProcessed
80  * </pre>
81  *
82  * <p>
83  * Queries that expect a result set (read commands mostly) send immediately
84  * after the requestStub a <em>subsetLengths</em> parameter, of type: <br>
85  * <strong>subsetLengths</strong>. See
86  * {@link org.continuent.sequoia.common.sql.RequestWithResultSetParameters#sendToStream(org.continuent.sequoia.common.stream.DriverBufferedOutputStream)}
87  *
88  * <pre>
89  * Int maxRows
90  * Int fetchSize
91  * </pre>
92  *
93  * <p>
94  * Depending on some configuration flag/state (shared by driver and controller),
95  * most query commands add an optional <em>skeleton</em> parameter of type
96  * optUTF.
97  * <h3>Received types</h3>
98  * <p>
99  * Several commands receive a ResultSet of type: <br>
100  * <strong>ResultSet</strong>
101  * {@link org.continuent.sequoia.driver.DriverResultSet#DriverResultSet(org.continuent.sequoia.driver.Connection)}
102  *
103  * <pre>
104  * {@link org.continuent.sequoia.common.protocol.Field Field}[] fields
105  * {@link org.continuent.sequoia.common.protocol.TypeTag}[] java column types
106  * ArrayList data
107  * optUTF hasMoreData: cursor name
108  * </pre> - <em>fields</em> is the description of the ResultSet columns. <br>-
109  * <em>data</em> is the actual data of the ResultSet. Each element of this
110  * list is an Object array holding one row of the ResultSet. The whole arraylist
111  * is serialized using standard Java serialization/readUnshared().
112  * <h3>Exceptions</h3>
113  * For almost every command sent, the driver checks if the reply is an exception
114  * serialized by the controller instead of the regular reply type. Most
115  * exceptions are put on the wire by
116  * {@link org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#run()}
117  * TODO: finish the classification below. <br>
118  * Exception reply recognized by the driver in: <br>
119  * FetchNextResultSetRows, closeRemoteResultSet, RestoreConnectionState,
120  * setAutoCommit, getCatalog, getCatalogs, setCatalog,
121  * getControllerVersionNumber, DatabaseMetaDataGetTables,
122  * DatabaseMetaDataGetColumns, DatabaseMetaDataGetPrimaryKeys,
123  * DatabaseMetaDataGetProcedureColumns, DatabaseMetaDataGetTableTypes,
124  * DatabaseMetaDataGetTablePrivileges, DatabaseMetaDataGetSchemas,
125  * DatabaseMetaDataGetDatabaseProductName, DatabaseStaticMetadata <br>
126  * Exception reply ignored by the driver in: Close, Reset <br>
127  * Exceptions catched by instanceof(catch-all) default clause in: <br>
128  * setAutoCommit, <br>
129  * Commands not implemented at all by the driver: <br>
130  * GetVirtualDatabaseName, <br>
131  * TODO: <br>- exceptions and the server side (VirtualDatabaseWorkerThread)
132  * <br>- double-check arguments and replies <br>- better topic ordering
133  *
134  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
135  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
136  * @author <a HREF="mailto:Marc.Herbert@emicnetworks.com">Marc Herbert </a>
137  * @author <a HREF="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
138  * </a>
139  * @version 1.0
140  */

141
142 public class Commands
143 {
144   /** "Controller Ready" magic number. */
145   public static final int ControllerPrompt = 0x1FA1501F;
146   /** Command prefix sent before each command */
147   public static final int CommandPrefix = 0xB015CA;
148
149   /**
150    * ALL commands are used ONLY by classes:
151    * {@link org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread}
152    * and {@link org.continuent.sequoia.driver.Connection}
153    * <p>
154    * EXCEPT constants ProtocolVersion and Ping which are used ONLY by classes:
155    * {@link org.continuent.sequoia.controller.core.ControllerWorkerThread} and
156    * {@link org.continuent.sequoia.driver.connectpolicy.ControllerPingThread}
157    * and which do NOT collide with the rest.
158    */

159
160   /**
161    * Command used to create a new connection, while checking that driver and
162    * controller are compatible with each other.
163    * <p>
164    * ~commandcode {@value}
165    * <p>
166    * <br>
167    * ~argument UTF dataBaseName<br>
168    * ~argument UTF user <br>
169    * ~argument UTF password
170    * <p>
171    * ~reply true | (false + failure message (vdb not found)) <br>
172    * ~reply true | (false + failure message (authentication error)) <br>
173    * <p>
174    * ~argument UTF lineSeparator<br>
175    * ~argument boolean persistentConnection<br>
176    * <p>
177    * ~if persistentConnection true<br>
178    * ~reply false if no connection is available on the cluster | (true +
179    * persistentConnectionId) <br>
180    *
181    * @see org.continuent.sequoia.controller.core.ControllerWorkerThread#run()
182    * @see org.continuent.sequoia.driver.ConnectionClosingThread#closeConnection(org.continuent.sequoia.driver.Connection)
183    */

184   public static final int ProtocolVersion = (8 /* major */<< 16) + 10 /* minor */;
185
186   /**
187    * Return the major version number of a protocol
188    *
189    * @param protocolVersion the protocol version number to extract the major
190    * from
191    * @return the protocol major version number
192    */

193   public static final int getProtocolMajorVersion(int protocolVersion)
194   {
195     return protocolVersion >>> 16;
196   }
197
198   /**
199    * Return the minor version number of a protocol
200    *
201    * @param protocolVersion the protocol version number to extract the minor
202    * from
203    * @return the protocol minor version number
204    */

205   public static final int getProtocolMinorVersion(int protocolVersion)
206   {
207     return protocolVersion & 0xFFFF;
208   }
209
210   /**
211    * Ping is used by the ControllerPingThread to check if a controller is back
212    * online after a failure.
213    *
214    * @see org.continuent.sequoia.controller.core.ControllerWorkerThread#run()
215    * @see org.continuent.sequoia.driver.connectpolicy.ControllerPingThread#run()
216    */

217   public static final int Ping = -1;
218
219   /**
220    * Performs a read request and returns the reply.
221    * <p>
222    * ~commandcode {@value}
223    * <p>
224    * <br>
225    * ~argument Int
226    * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
227    * ~argument requestStub <br>
228    * ~argument subsetLengths <br>
229    * ~argument optUTF cursorname <br>
230    * ~argument optUTF skeleton
231    * <p>
232    * <br>
233    * ~reply ResultSet
234    *
235    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteQuery(org.continuent.sequoia.controller.requests.SelectRequest)
236    */

237   public static final int StatementExecuteQuery = 0;
238
239   /**
240    * Performs a write request and returns the number of rows affected.
241    * <p>
242    * ~commandcode {@value}
243    * <p>
244    * <br>
245    * ~argument Int
246    * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
247    * ~argument requestStub <br>
248    * ~argument optUTF skeleton
249    * <p>
250    * <br>
251    * ~reply request id (long) <br>
252    * ~reply nbRows (int)
253    *
254    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteUpdate(org.continuent.sequoia.controller.requests.AbstractWriteRequest)
255    */

256   public static final int StatementExecuteUpdate = 1;
257
258   /**
259    * Performs a write request and returns the auto generated keys.
260    * <p>
261    * ~commandcode {@value}
262    * <p>
263    * <br>
264    * ~argument Int
265    * {@link org.continuent.sequoia.controller.requests.RequestType} <br>
266    * ~argument requestStub <br>
267    * ~argument subsetLengths <br>
268    * ~argument optUTF skeleton
269    * <p>
270    * <br>
271    * ~reply request id (long) <br>
272    * ~reply nbRows <br>
273    * ~reply ResultSet
274    *
275    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#statementExecuteUpdateWithKeys()
276    */

277   public static final int StatementExecuteUpdateWithKeys = 2;
278
279   /**
280    * Calls a stored procedure and returns the reply (ResultSet).
281    * <p>
282    * ~commandcode {@value}
283    * <p>
284    * <br>
285    * ~argument requestStub <br>
286    * ~argument subsetLengths <br>
287    * ~argument optUTF skeleton
288    * <p>
289    * <br>
290    * ~reply request id (long)<br>
291    * ~reply ResultSet
292    *
293    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
294    * @deprecated since 2.7
295    */

296   public static final int CallableStatementExecuteQuery = 3;
297
298   /**
299    * Calls a stored procedure and returns the number of rows affected (write
300    * query).
301    * <p>
302    * ~commandcode {@value}
303    * <p>
304    * <br>
305    * ~argument requestStub <br>
306    * ~argument optUTF skeleton
307    * <p>
308    * <br>
309    * ~reply long request id <br>
310    * ~reply int nbRows
311    *
312    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
313    * @deprecated since 2.7
314    */

315   public static final int CallableStatementExecuteUpdate = 4;
316
317   /**
318    * Calls a stored procedure using CallableStatement.execute(). This returns an
319    * arbitrary number of update counts and ResultSets
320    * <p>
321    * ~commandcode {@value}
322    * <p>
323    * <br>
324    * ~argument requestStub <br>
325    * ~argument optUTF skeleton
326    * <p>
327    * <br>
328    * ~reply long request id <br>
329    * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
330    * follows)<br>
331    * ~reply Int nbRows (-1 if no more results)<br>
332    * ~reply ResultSet
333    *
334    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecute(org.continuent.sequoia.controller.requests.StoredProcedure)
335    * @deprecated since 2.7
336    */

337   public static final int CallableStatementExecute = 5;
338
339   /**
340    * Execute a request using Statement.execute(). This returns an arbitrary
341    * number of update counts and ResultSets
342    * <p>
343    * ~commandcode {@value}
344    * <p>
345    * <br>
346    * ~argument requestStub <br>
347    * ~argument optUTF skeleton
348    * <p>
349    * <br>
350    * ~reply long request id <br>
351    * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
352    * follows) <br>
353    * ~reply Int nbRows (-1 if no more results) <br>
354    * ~reply ResultSet
355    *
356    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#statementExecute(org.continuent.sequoia.controller.requests.AbstractRequest)
357    */

358   public static final int StatementExecute = 6;
359
360   /**
361    * Calls a stored procedure with IN/OUT and/or named parameters and returns
362    * the reply (ResultSet, OUT parameters, named parameters objects).
363    * <p>
364    * ~commandcode {@value}
365    * <p>
366    * <br>
367    * ~argument requestStub <br>
368    * ~argument subsetLengths <br>
369    * ~argument optUTF skeleton
370    * <p>
371    * <br>
372    * ~reply request id (long)<br>
373    * ~reply ResultSet<br>
374    * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
375    * ~reply Object OUT parameter value (if index != 0)<br>
376    * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
377    * ~reply Object named parameter value (if name != "0")<br>
378    *
379    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
380    */

381   public static final int CallableStatementExecuteQueryWithParameters = 7;
382
383   /**
384    * Calls a stored procedure and returns the number of rows affected (write
385    * query).
386    * <p>
387    * ~commandcode {@value}
388    * <p>
389    * <br>
390    * ~argument requestStub <br>
391    * ~argument optUTF skeleton
392    * <p>
393    * <br>
394    * ~reply long request id <br>
395    * ~reply int nbRows (update count) <br>
396    * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
397    * ~reply Object OUT parameter value (if index != 0)<br>
398    * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
399    * ~reply Object named parameter value (if name != "0")<br>
400    *
401    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecuteQuery(org.continuent.sequoia.controller.requests.StoredProcedure)
402    */

403   public static final int CallableStatementExecuteUpdateWithParameters = 8;
404
405   /**
406    * Calls a stored procedure using CallableStatement.execute(). This returns an
407    * arbitrary number of update counts and ResultSets
408    * <p>
409    * ~commandcode {@value}
410    * <p>
411    * <br>
412    * ~argument requestStub <br>
413    * ~argument optUTF skeleton
414    * <p>
415    * <br>
416    * ~reply long request id <br>
417    * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
418    * follows) <br>
419    * ~reply Int nbRows (-1 if no more results)<br>
420    * ~reply ResultSet<br>
421    * Once all results have been fetched, we fetch OUT and named parameters as
422    * follows:<br>
423    * ~reply int OUT parameter index (0 if no more OUT parameter to be sent)<br>
424    * ~reply Object OUT parameter value (if index != 0)<br>
425    * ~reply String parameter name ("0" if no more OUT parameter to be sent)<br>
426    * ~reply Object named parameter value (if name != "0")<br>
427    *
428    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#callableStatementExecute(org.continuent.sequoia.controller.requests.StoredProcedure)
429    */

430   public static final int CallableStatementExecuteWithParameters = 9;
431
432   /*
433    * Failover commands
434    */

435
436   /**
437    * Try to retrieve the result of a previouly executed query using
438    * executeQuery().
439    * <p>
440    * ~commandcode {@value}
441    * <p>
442    * <br>
443    * ~argument long request id
444    * <p>
445    * <br>
446    * ~reply ResultSet (or null)
447    */

448   public static final int RetrieveExecuteQueryResult = 10;
449
450   /**
451    * Try to retrieve the result of a previouly executed query.
452    * <p>
453    * ~commandcode {@value}
454    * <p>
455    * <br>
456    * ~argument long request id
457    * <p>
458    * <br>
459    * ~reply int nbRows (-1 if no result has been found)
460    */

461   public static final int RetrieveExecuteUpdateResult = 11;
462
463   /**
464    * Try to retrieve the result of a previouly executed query.
465    * <p>
466    * ~commandcode {@value}
467    * <p>
468    * <br>
469    * ~argument long request id
470    * <p>
471    * <br>
472    * ~reply null if no result was found <br>
473    * ~reply long request id <br>
474    * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
475    * follows) <br>
476    * ~reply Int nbRows (-1 if no more results) <br>
477    * ~reply ResultSet
478    */

479   public static final int RetrieveExecuteResult = 12;
480
481   /**
482    * Try to retrieve the result of a previouly executed query.
483    * <p>
484    * ~commandcode {@value}
485    * <p>
486    * <br>
487    * ~argument long request id
488    * <p>
489    * <br>
490    * ~reply int nbRows (-1 if no result has been found) <br>
491    * ~reply ResultSet (if nbRows was != -1)
492    */

493   public static final int RetrieveExecuteUpdateWithKeysResult = 13;
494
495   /**
496    * Try to retrieve the result of a previouly executed commit. If the commit
497    * was not executed before, the controller will execute it and return the
498    * result which is the transaction id acknowledgement.
499    * <p>
500    * ~commandcode {@value}
501    * <p>
502    * <br>
503    * ~reply Long transactionId: id of commited transaction
504    */

505   public static final int RetrieveCommitResult = 14;
506
507   /**
508    * Try to retrieve the result of a previouly executed rollback. If the
509    * rollback was not executed before, the controller will execute it and return
510    * the result which is the transaction id acknowledgement.
511    * <p>
512    * ~commandcode {@value}
513    * <p>
514    * <br>
515    * ~reply Long transactionId: id of rollbacked transaction
516    */

517   public static final int RetrieveRollbackResult = 15;
518
519   /**
520    * Try to retrieve the result of a previouly executed stored procedure with
521    * IN/OUT and/or named parameters using executeQuery().
522    * <p>
523    * ~commandcode {@value}
524    * <p>
525    * <br>
526    * ~argument long request id
527    * <p>
528    * <br>
529    * ~reply ResultSet (or null) ~reply int number of OUT parameters<br>
530    * ~reply Object OUT parameter values (nb of times indicated above)<br>
531    * ~reply int number of named parameters<br>
532    * ~reply String parameter name<br>
533    * ~reply Object named parameter value (nb of times indicated above)<br>
534    */

535   public static final int RetrieveExecuteQueryResultWithParameters = 16;
536
537   /**
538    * Try to retrieve the result of a previouly executed stored procedure with
539    * IN/OUT and/or named parameters.
540    * <p>
541    * ~commandcode {@value}
542    * <p>
543    * <br>
544    * ~argument long request id
545    * <p>
546    * <br>
547    * ~reply int nbRows (-1 if no result has been found) ~reply int number of OUT
548    * parameters<br>
549    * ~reply Object OUT parameter values (nb of times indicated above)<br>
550    * ~reply int number of named parameters<br>
551    * ~reply String parameter name<br>
552    * ~reply Object named parameter value (nb of times indicated above)<br>
553    */

554   public static final int RetrieveExecuteUpdateResultWithParameters = 17;
555
556   /**
557    * Try to retrieve the result of a previouly executed stored procedure with
558    * IN/OUT and/or named parameters.
559    * <p>
560    * ~commandcode {@value}
561    * <p>
562    * <br>
563    * ~argument long request id
564    * <p>
565    * <br>
566    * ~reply null if no result was found <br>
567    * ~reply long request id <br>
568    * ~reply boolean hasResultSet (true means ResultSet follows, false means Int
569    * follows) <br>
570    * ~reply Int nbRows (-1 if no more results) <br>
571    * ~reply ResultSet<br>
572    * Once all results have been fetched, we fetch OUT and named parameters as
573    * follows:<br>
574    * ~reply int number of OUT parameters<br>
575    * ~reply Object OUT parameter values (nb of times indicated above)<br>
576    * ~reply int number of named parameters<br>
577    * ~reply String parameter name<br>
578    * ~reply Object named parameter value (nb of times indicated above)<br>
579    */

580   public static final int RetrieveExecuteResultWithParameters = 18;
581
582   /**
583    * Begins a new transaction and returns the corresponding transaction
584    * identifier. This method is called from the driver when
585    * {@link org.continuent.sequoia.driver.Connection#setAutoCommit(boolean)}is
586    * called with <code>false</code> argument.
587    * <p>
588    * ~commandcode {@value}
589    * <p>
590    * <br>
591    * ~reply Long transactionId
592    *
593    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#begin(String,
594    * boolean, long)
595    */

596   public static final int Begin = 20;
597
598   /**
599    * Commits the current transaction.
600    * <p>
601    * ~commandcode {@value}
602    * <p>
603    * <br>
604    * ~reply Long transactionId: id of commited transaction
605    *
606    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#commit(long,
607    * boolean, boolean)
608    */

609   public static final int Commit = 21;
610
611   /**
612    * Rollbacks the current transaction.
613    * <p>
614    * ~commandcode {@value}
615    * <p>
616    * <br>
617    * ~reply Long transactionId: id of rollbacked transaction
618    *
619    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#rollback(long,
620    * boolean)
621    */

622   public static final int Rollback = 22;
623
624   /**
625    * Sets a named savepoint to a transaction given its id
626    *
627    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#setSavepoint(long,
628    * String)
629    */

630   public static final int SetNamedSavepoint = 23;
631
632   /**
633    * Sets a unnamed savepoint to a transaction given its id
634    *
635    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#setSavepoint(long)
636    */

637   public static final int SetUnnamedSavepoint = 24;
638
639   /**
640    * Releases a savepoint from a transaction given its id
641    *
642    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#releaseSavepoint(long,
643    * String)
644    */

645   public static final int ReleaseSavepoint = 25;
646
647   /**
648    * Rollbacks the current transaction back to the given savepoint
649    *
650    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#rollbackToSavepoint()
651    */

652   public static final int RollbackToSavepoint = 26;
653
654   /*
655    * Connection management
656    */

657
658   /**
659    * Close the connection. The controller replies a CommandCompleted
660    * SequoiaException, ignored by the driver.
661    * <p>
662    * ~commandcode {@value}
663    * <p>
664    * <br>
665    * ~reply &lt;anything&gt;
666    */

667   public static final int Close = 30;
668
669   /**
670    * Reset the connection.
671    * <p>
672    * ~commandcode {@value}
673    */

674   public static final int Reset = 31;
675
676   /**
677    * Fetch next rows of data for ResultSet streaming.
678    * <p>
679    * ~commandcode {@value}
680    * <p>
681    * <br>
682    * ~argument UTF cursorName <br>
683    * ~argument Int fetchSize
684    * <p>
685    * <br>
686    * ~reply ArrayList data <br>
687    * ~reply boolean hasMoreData
688    */

689   public static final int FetchNextResultSetRows = 32;
690
691   /**
692    * Closes a remote ResultSet that was opened for streaming.
693    * <p>
694    * ~commandcode {@value}
695    * <p>
696    * <br>
697    * ~argument UTF cursorName
698    * <p>
699    * <br>
700    * ~reply SequoiaException CommandCompleted
701    */

702   public static final int CloseRemoteResultSet = 33;
703
704   /**
705    * Restore a connection state after an automatic reconnection. Tell the
706    * controller if we were in autoCommit mode (i.e.: a transaction was
707    * <em>not</em> started), and if we were not then give the current
708    * transactionId. Warning: this is not an optUTF type at all.
709    * <p>
710    * ~commandcode {@value}
711    * <p>
712    * <br>
713    * ~argument boolean writeExecutedInTransaction<br>
714    * ~argument (boolean true) | (boolean false; Long transactionId) <br>
715    * ~argument (boolean false) | (boolean true; persistentConnectionId) <br>
716    */

717   public static final int RestoreConnectionState = 34;
718
719   /**
720    * Retrieve the catalog (database) we are connected to.
721    * <p>
722    * ~commandcode {@value}
723    * <p>
724    * <br>
725    * ~reply String vdbName
726    *
727    * @see org.continuent.sequoia.driver.Connection#getCatalog()
728    */

729   public static final int ConnectionGetCatalog = 36;
730
731   /**
732    * Retrieve the list of available catalogs (databases).
733    * <p>
734    * ~commandcode {@value}
735    * <p>
736    * <br>
737    * ~reply ResultSet virtualDatabasesList
738    *
739    * @see org.continuent.sequoia.driver.Connection#getCatalogs()
740    */

741   public static final int ConnectionGetCatalogs = 37;
742
743   /**
744    * Connect to another catalog/database (as the same user).
745    * <p>
746    * ~commandcode {@value}
747    * <p>
748    * <br>
749    * ~argument UTF catalog
750    * <p>
751    * <br>
752    * ~reply boolean isValidCatalog
753    *
754    * @see org.continuent.sequoia.driver.Connection#setCatalog(String)
755    */

756   public static final int ConnectionSetCatalog = 38;
757
758   /**
759    * Set the new transaction isolation level to use for this connection.
760    * <p>
761    * ~commandcode {@value}
762    * <p>
763    * <br>
764    * ~argument int transaction isolation level
765    * <p>
766    * <br>
767    * ~reply boolean true (meaning: not an exception)
768    *
769    * @see org.continuent.sequoia.driver.Connection#setTransactionIsolation(int)
770    */

771   public static final int SetTransactionIsolation = 39;
772
773   /**
774    * Retrieves the SQLWarning chain associated to a persistent connection to a
775    * backend.
776    * <p>
777    * ~commandcode {@value}<br>
778    * ~argument int persistent connection id
779    * <p>
780    * <br>
781    * ~reply BackendDriverException SQLWarning chain wrapped into a bde
782    *
783    * @see org.continuent.sequoia.driver.Connection#getWarnings()
784    */

785   public static final int ConnectionGetWarnings = 40;
786
787   /**
788    * Clears the SQLWarning chain associated to a persistent connection
789    * <p>
790    * ~commandcode {@value}<br>
791    * ~argument int persistent connection id
792    * <p>
793    * <br>
794    * ~reply boolean true (meaning: not an exception)
795    *
796    * @see org.continuent.sequoia.driver.Connection#clearWarnings()
797    */

798   public static final int ConnectionClearWarnings = 41;
799
800   /**
801    * Set the connection readonly status.
802    * <p>
803    * ~commandcode {@value}
804    * <p>
805    * <br>
806    * ~argument boolean readOnly value
807    * <p>
808    * <br>
809    * ~reply boolean true (meaning: not an exception)
810    *
811    * @see org.continuent.sequoia.driver.Connection#setReadOnly(boolean)
812    */

813   public static final int SetReadOnly = 42;
814
815   /*
816    * MetaData functions
817    */

818
819   /**
820    * Gets the virtual database name to be used by the client (Sequoia driver).
821    * It currently returns the same result as ConnectionGetCatalog(). It is
822    * currently never used by the driver.
823    * <p>
824    * ~commandcode {@value}
825    * <p>
826    * <br>
827    * ~reply String dbName
828    *
829    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase#getVirtualDatabaseName()
830    */

831   public static final int GetVirtualDatabaseName = 50;
832
833   /**
834    * Gets the controller version number.
835    * <p>
836    * ~commandcode {@value}
837    * <p>
838    * <br>
839    * ~reply String controllerVersion
840    *
841    * @see org.continuent.sequoia.controller.core.Controller#getVersionNumber()
842    */

843   public static final int GetControllerVersionNumber = 51;
844
845   /**
846    * Used to get the schema tables by calling DatabaseMetaData.getTables().
847    * <p>
848    * ~commandcode {@value}
849    * <p>
850    * <br>
851    * ~argument UTF catalog <br>
852    * ~argument UTF schemaPattern <br>
853    * ~argument UTF tableNamePattern <br>
854    * ~argument String[] types
855    * <p>
856    * <br>
857    * ~reply ResultSet tables
858    *
859    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTables()
860    */

861   public static final int DatabaseMetaDataGetTables = 52;
862
863   /**
864    * Used to get the schema columns by calling DatabaseMetaData.getColumns().
865    * <p>
866    * ~commandcode {@value}
867    * <p>
868    * <br>
869    * ~argument UTF catalog <br>
870    * ~argument UTF schemaPattern <br>
871    * ~argument UTF tableNamePattern <br>
872    * ~argument UTF columnNamePattern
873    * <p>
874    * <br>
875    * ~reply ResultSet schemaColumns
876    *
877    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetColumns()
878    */

879   public static final int DatabaseMetaDataGetColumns = 53;
880
881   /**
882    * Used to get the schema primary keys by calling
883    * DatabaseMetaData.getColumns().
884    * <p>
885    * ~commandcode {@value}
886    * <p>
887    * <br>
888    * ~argument UTF catalog <br>
889    * ~argument UTF schemaPattern <br>
890    * ~argument UTF tableNamePattern
891    * <p>
892    * <br>
893    * ~reply ResultSet pKeys
894    *
895    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetPrimaryKeys()
896    */

897   public static final int DatabaseMetaDataGetPrimaryKeys = 54;
898
899   /**
900    * Used to get the schema procedures by calling
901    * DatabaseMetaData.getProcedures().
902    * <p>
903    * ~commandcode {@value}
904    * <p>
905    * <br>
906    * ~argument UTF catalog <br>
907    * ~argument UTF schemaPattern <br>
908    * ~argument UTF procedureNamePattern
909    * <p>
910    * <br>
911    * ~reply ResultSet procedures
912    *
913    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetProcedures()
914    */

915   public static final int DatabaseMetaDataGetProcedures = 55;
916
917   /**
918    * Used to get the schema procedure columns by calling
919    * DatabaseMetaData.getProcedureColumns().
920    * <p>
921    * ~commandcode {@value}
922    * <p>
923    * <br>
924    * ~argument UTF catalog <br>
925    * ~argument UTF schemaPattern <br>
926    * ~argument UTF procedureNamePattern <br>
927    * ~argument UTF columnNamePattern
928    * <p>
929    * <br>
930    * ~reply ResultSet procColumns
931    *
932    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetProcedureColumns()
933    */

934   public static final int DatabaseMetaDataGetProcedureColumns = 56;
935
936   /**
937    * Retrieve the database table types.
938    * <p>
939    * ~commandcode {@value}
940    * <p>
941    * <br>
942    * ~reply ResultSet tableTypes
943    *
944    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTableTypes()
945    */

946   public static final int DatabaseMetaDataGetTableTypes = 58;
947
948   /**
949    * Retrieve the table privileges.
950    * <p>
951    * ~commandcode {@value}
952    * <p>
953    * <br>
954    * ~argument UTF catalog <br>
955    * ~argument UTF schemaPattern <br>
956    * ~argument UTF tableNamePattern
957    * <p>
958    * <br>
959    * ~reply ResultSet accessRights
960    *
961    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTablePrivileges()
962    */

963   public static final int DatabaseMetaDataGetTablePrivileges = 59;
964
965   /**
966    * Retrieve the schemas.
967    * <p>
968    * ~commandcode {@value}
969    * <p>
970    * <br>
971    * ~reply ResultSet schemas
972    *
973    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSchemas()
974    */

975   public static final int DatabaseMetaDataGetSchemas = 60;
976
977   /**
978    * Retrieve the database product name.
979    * <p>
980    * ~commandcode {@value}
981    * <p>
982    * <br>
983    * ~reply String productName
984    *
985    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetDatabaseProductName()
986    */

987   public static final int DatabaseMetaDataGetDatabaseProductName = 61;
988
989   /**
990    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetAttributes()
991    */

992   public static final int DatabaseMetaDataGetAttributes = 62;
993
994   /**
995    * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetBestRowIdentifier()
996    */

997   public static final int DatabaseMetaDataGetBestRowIdentifier = 63;
998
999   /**
1000   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetColumnPrivileges()
1001   */

1002  public static final int DatabaseMetaDataGetColumnPrivileges = 64;
1003
1004  /**
1005   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetCrossReference()
1006   */

1007  public static final int DatabaseMetaDataGetCrossReference = 65;
1008
1009  /**
1010   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetExportedKeys()
1011   */

1012  public static final int DatabaseMetaDataGetExportedKeys = 66;
1013
1014  /**
1015   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetImportedKeys()
1016   */

1017  public static final int DatabaseMetaDataGetImportedKeys = 67;
1018
1019  /**
1020   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetIndexInfo()
1021   */

1022  public static final int DatabaseMetaDataGetIndexInfo = 68;
1023
1024  /**
1025   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSuperTables()
1026   */

1027  public static final int DatabaseMetaDataGetSuperTables = 69;
1028
1029  /**
1030   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetSuperTypes()
1031   */

1032  public static final int DatabaseMetaDataGetSuperTypes = 70;
1033
1034  /**
1035   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetTypeInfo()
1036   */

1037  public static final int DatabaseMetaDataGetTypeInfo = 71;
1038
1039  /**
1040   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseMetaDataGetUDTs()
1041   */

1042  public static final int DatabaseMetaDataGetUDTs = 72;
1043
1044  /**
1045   * @see java.sql.DatabaseMetaData#getVersionColumns(java.lang.String,
1046   * java.lang.String, java.lang.String)
1047   */

1048  public static final int DatabaseMetaDataGetVersionColumns = 73;
1049
1050  /**
1051   * Retrieve one value from the virtual database metadata.
1052   * <p>
1053   * ~commandcode {@value}
1054   * <p>
1055   * <br>
1056   * ~argument UTF: serialized DatabaseMetaData method call.
1057   * <p>
1058   * <br>
1059   * ~reply Integer|Boolean|String|other ? value
1060   *
1061   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#databaseStaticMetadata()
1062   */

1063  public static final int DatabaseStaticMetadata = 80;
1064
1065  /**
1066   * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabaseWorkerThread#preparedStatementGetMetaData()
1067   */

1068  public static final int PreparedStatementGetMetaData = 81;
1069
1070  /**
1071   * Try to retrieve the result of a previouly executed release savepoint using
1072   * releaseSavepoint().
1073   * <p>
1074   * ~commandcode {@value}
1075   * <p>
1076   * <br>
1077   * ~argument String savepoint name
1078   * <p>
1079   * <br>
1080   * ~reply boolean: true if the savepoint was removed, false if it is still
1081   * there.
1082   */

1083  public static final int RetrieveReleaseSavepoint = 82;
1084
1085}
1086
Popular Tags