|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.driver.protocol.Commands
Protocol commands between C-JDBC driver (client) and controller (server). All
communications follow a classic RPC scheme: the driver sends a Command code,
followed by argument(s) for some of the commands, and expects some answer(s),
at the very least an error code or an exception. The server is event-driven;
communications are inited by the client which is the one sending Protocol
commands, so the verbs send and receive must be
understood as from driver point of view. Almost all these commands are put on
the wire by client class Connection
and
read (and answered) by class VirtualDatabaseWorkerThread.run()
.
The only exceptions are the following commands:
- ProtocolVersion
read only by ControllerWorkerThread.run()
, which then
constructs the connection and pass it to VirtualDatabaseWorkerThread for the
rest of the execution of this command.
- Close
in addition to Connection, also sent by
ConnectionClosingThread.closeConnection(Connection)
- Ping
sent on a dedicated connection only by ControllerPingThread.run()
and
silently received only by (again) ControllerWorkerThread.run()
(boolean false) | (boolean true; UTF somestring)
Several commands send a SQL query. All SQL queries sent on the wire use the
same starting pattern, a requestStub defined below and in
AbstractRequest.AbstractRequest(CJDBCInputStream, int)
requestStub
UTF request : SQL query boolean EscapeProcessing UTF LINE_SEPARATOR Int timeout boolean autoCommit boolean isDriverProcessed
Queries that expect a result set (read commands mostly) send immediately
after the requestStub a subsetLengths parameter, of type:
subsetLengths. See
AbstractRequest.receiveResultSetParams(CJDBCInputStream)
Int maxRows Int fetchSize
Depending on some configuration flag/state (shared by driver and controller), most query commands add an optional skeleton parameter of type optUTF.
Several commands receive a ResultSet of type:
ResultSet
org.objectweb.cjdbc.driver.DriverResultSet#DriverResultSet(CJDBCInputStream)
- fields is the description of the ResultSet columns.Field
[] fieldsTypeTag
[] java column types ArrayList data optUTF hasMoreData: cursor name
VirtualDatabaseWorkerThread.run()
TODO: finish the classification below.
Field Summary | |
static int |
Begin
Begins a new transaction and returns the corresponding transaction identifier. |
static int |
Close
Close the connection. |
static int |
CloseRemoteResultSet
Closes a remote ResultSet that was opened for streaming. |
static int |
Commit
Commits the current transaction. |
static int |
ConnectionGetCatalog
Retrieve the catalog (database) we are connected to. |
static int |
ConnectionGetCatalogs
Retrieve the list of available catalogs (databases). |
static int |
ConnectionSetCatalog
Connect to another catalog/database (as the same user). |
static int |
DatabaseMetaDataGetAttributes
|
static int |
DatabaseMetaDataGetBestRowIdentifier
|
static int |
DatabaseMetaDataGetColumnPrivileges
|
static int |
DatabaseMetaDataGetColumns
Used to get the schema columns by calling DatabaseMetaData.getColumns(). |
static int |
DatabaseMetaDataGetCrossReference
|
static int |
DatabaseMetaDataGetDatabaseProductName
Retrieve the database product name. |
static int |
DatabaseMetaDataGetExportedKeys
|
static int |
DatabaseMetaDataGetImportedKeys
|
static int |
DatabaseMetaDataGetIndexInfo
|
static int |
DatabaseMetaDataGetPrimaryKeys
Used to get the schema primary keys by calling DatabaseMetaData.getColumns(). |
static int |
DatabaseMetaDataGetProcedureColumns
Used to get the schema procedure columns by calling DatabaseMetaData.getProcedureColumns(). |
static int |
DatabaseMetaDataGetProcedures
Used to get the schema procedures by calling DatabaseMetaData.getProcedures(). |
static int |
DatabaseMetaDataGetSchemas
Retrieve the schemas. |
static int |
DatabaseMetaDataGetSuperTables
|
static int |
DatabaseMetaDataGetSuperTypes
|
static int |
DatabaseMetaDataGetTablePrivileges
Retrieve the table privileges. |
static int |
DatabaseMetaDataGetTables
Used to get the schema tables by calling DatabaseMetaData.getTables(). |
static int |
DatabaseMetaDataGetTableTypes
Retrieve the database table types. |
static int |
DatabaseMetaDataGetTypeInfo
|
static int |
DatabaseMetaDataGetUDTs
|
static int |
DatabaseMetaDataGetVersionColumns
|
static int |
DatabaseStaticMetadata
Retrieve one value from the virtual database metadata. |
static int |
ExecReadRequest
Performs a read request and returns the reply. |
static int |
ExecReadStoredProcedure
Calls a stored procedure and returns the reply (ResultSet). |
static int |
ExecWriteRequest
Performs a write request and returns the number of rows affected. |
static int |
ExecWriteRequestWithKeys
Performs a write request and returns the auto generated keys. |
static int |
ExecWriteStoredProcedure
Calls a stored procedure and returns the number of rows affected (write query). |
static int |
FetchNextResultSetRows
Fetch next rows of data for ResultSet streaming. |
static int |
GetControllerVersionNumber
Gets the controller version number. |
static int |
GetVirtualDatabaseName
Gets the virtual database name to be used by the client (C-JDBC driver). |
static int |
Ping
Ping is used by the ControllerPingThread to check if a controller is back online after a failure. |
static int |
ProtocolVersion
Command used to create a new connection, while checking that driver and controller are compatible with each other. |
static int |
ReleaseSavepoint
Releases a savepoint from a transaction given its id |
static int |
Reset
Reset the connection. |
static int |
RestoreConnectionState
Restore a connection state after an automatic reconnection. |
static int |
Rollback
Rollbacks the current transaction. |
static int |
RollbackToSavepoint
Rollbacks the current transaction back to the given savepoint |
static int |
SetAutoCommit
Command to change the autocommit value from false to true. |
static int |
SetNamedSavepoint
Sets a named savepoint to a transaction given its id |
static int |
SetTransactionIsolation
Set the new transaction isolation level to use for this connection. |
static int |
SetUnnamedSavepoint
Sets a unnamed savepoint to a transaction given its id |
Constructor Summary | |
Commands()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ProtocolVersion
~commandcode 20
~argument UTF dataBaseName
~argument UTF user
~argument UTF password
~reply boolean needSkeleton: Does the controller require the SQL skeleton?
This is only a boolean here, not the full optUTF skeleton often used
elsewhere.
~reply UTF sfilter: the kind of blob encoding the server wants the driver
to use
ControllerWorkerThread.run()
,
ConnectionClosingThread.closeConnection(Connection)
,
Constant Field Valuespublic static final int Ping
ControllerWorkerThread.run()
,
ControllerPingThread.run()
,
Constant Field Valuespublic static final int ExecReadRequest
~commandcode 0
~argument requestStub
~argument subsetLengths
~argument optUTF cursorname
~argument optUTF skeleton
~reply ResultSet
VirtualDatabaseWorkerThread.execReadRequest()
,
Constant Field Valuespublic static final int ExecWriteRequest
~commandcode 1
~argument Int RequestType
~argument requestStub
~argument optUTF skeleton
~reply nbRows
VirtualDatabaseWorkerThread.execWriteRequest()
,
Constant Field Valuespublic static final int ExecWriteRequestWithKeys
~commandcode 2
~argument Int RequestType
~argument requestStub
~argument subsetLengths
~argument optUTF skeleton
~reply ResultSet
VirtualDatabaseWorkerThread.execWriteRequestWithKeys()
,
Constant Field Valuespublic static final int ExecReadStoredProcedure
~commandcode 3
~argument requestStub
~argument subsetLengths
~argument optUTF skeleton
~reply ResultSet
VirtualDatabase.execReadStoredProcedure(org.objectweb.cjdbc.common.sql.StoredProcedure)
,
Constant Field Valuespublic static final int ExecWriteStoredProcedure
~commandcode 4
~argument requestStub
~argument optUTF skeleton
~reply Int nbRows
VirtualDatabase.execReadStoredProcedure(org.objectweb.cjdbc.common.sql.StoredProcedure)
,
Constant Field Valuespublic static final int Begin
Connection.setAutoCommit(boolean)
is
called with false
argument.
~commandcode 20
~reply Long transactionId
VirtualDatabase.begin(String)
,
Constant Field Valuespublic static final int Commit
~commandcode 21
~reply Long transactionId: id of next transaction
VirtualDatabase.commit(long,
boolean)
,
Constant Field Valuespublic static final int Rollback
~commandcode 22
~reply Long transactionId: id of next transaction
VirtualDatabase.rollback(long,
boolean)
,
Constant Field Valuespublic static final int SetNamedSavepoint
VirtualDatabase.setSavepoint(long,
String)
,
Constant Field Valuespublic static final int SetUnnamedSavepoint
VirtualDatabase.setSavepoint(long)
,
Constant Field Valuespublic static final int ReleaseSavepoint
VirtualDatabase.releaseSavepoint(long,
String)
,
Constant Field Valuespublic static final int RollbackToSavepoint
VirtualDatabaseWorkerThread.rollbackToSavepoint()
,
Constant Field Valuespublic static final int Close
~commandcode 30
~reply <anything>
public static final int Reset
~commandcode 31
public static final int FetchNextResultSetRows
~commandcode 32
~argument UTF cursorName
~argument Int fetchSize
~reply ArrayList data
~reply boolean hasMoreData
public static final int CloseRemoteResultSet
~commandcode 33
~argument UTF cursorName
~reply CJDBCException CommandCompleted
public static final int RestoreConnectionState
~commandcode 34
~argument (boolean true) | (boolean false; Long transactionId)
public static final int SetAutoCommit
~commandcode 35
~reply boolean true (meaning: not an exception)
public static final int ConnectionGetCatalog
~commandcode 36
~reply String vdbName
Connection.getCatalog()
,
Constant Field Valuespublic static final int ConnectionGetCatalogs
~commandcode 37
~reply ResultSet virtualDatabasesList
Connection.getCatalogs()
,
Constant Field Valuespublic static final int ConnectionSetCatalog
~commandcode 38
~argument UTF catalog
~reply boolean isValidCatalog
Connection.setCatalog(String)
,
Constant Field Valuespublic static final int SetTransactionIsolation
~commandcode 39
~argument int transaction isolation level
~reply boolean true (meaning: not an exception)
Connection.setTransactionIsolation(int)
,
Constant Field Valuespublic static final int GetVirtualDatabaseName
~commandcode 50
~reply String dbName
VirtualDatabase.getVirtualDatabaseName()
,
Constant Field Valuespublic static final int GetControllerVersionNumber
~commandcode 51
~reply String controllerVersion
Controller.getVersionNumber()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetTables
~commandcode 52
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF tableNamePattern
~argument String[] types
~reply ResultSet tables
VirtualDatabaseWorkerThread.databaseMetaDataGetTables()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetColumns
~commandcode 53
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF tableNamePattern
~argument UTF columnNamePattern
~reply ResultSet schemaColumns
VirtualDatabaseWorkerThread.databaseMetaDataGetColumns()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetPrimaryKeys
~commandcode 54
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF tableNamePattern
~reply ResultSet pKeys
VirtualDatabaseWorkerThread.databaseMetaDataGetPrimaryKeys()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetProcedures
~commandcode 55
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF procedureNamePattern
~reply ResultSet procedures
VirtualDatabaseWorkerThread.databaseMetaDataGetProcedures()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetProcedureColumns
~commandcode 56
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF procedureNamePattern
~argument UTF columnNamePattern
~reply ResultSet procColumns
VirtualDatabaseWorkerThread.databaseMetaDataGetProcedureColumns()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetTableTypes
~commandcode 58
~reply ResultSet tableTypes
VirtualDatabaseWorkerThread.databaseMetaDataGetTableTypes()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetTablePrivileges
~commandcode 59
~argument UTF catalog
~argument UTF schemaPattern
~argument UTF tableNamePattern
~reply ResultSet accessRights
VirtualDatabaseWorkerThread.databaseMetaDataGetTablePrivileges()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetSchemas
~commandcode 60
~reply ResultSet schemas
VirtualDatabaseWorkerThread.databaseMetaDataGetSchemas()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetDatabaseProductName
~commandcode 61
~reply String productName
VirtualDatabaseWorkerThread.databaseMetaDataGetDatabaseProductName()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetAttributes
VirtualDatabaseWorkerThread.databaseMetaDataGetAttributes()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetBestRowIdentifier
VirtualDatabaseWorkerThread.databaseMetaDataGetBestRowIdentifier()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetColumnPrivileges
VirtualDatabaseWorkerThread.databaseMetaDataGetColumnPrivileges()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetCrossReference
VirtualDatabaseWorkerThread.databaseMetaDataGetCrossReference()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetExportedKeys
VirtualDatabaseWorkerThread.databaseMetaDataGetExportedKeys()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetImportedKeys
VirtualDatabaseWorkerThread.databaseMetaDataGetImportedKeys()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetIndexInfo
VirtualDatabaseWorkerThread.databaseMetaDataGetIndexInfo()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetSuperTables
VirtualDatabaseWorkerThread.databaseMetaDataGetSuperTables()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetSuperTypes
VirtualDatabaseWorkerThread.databaseMetaDataGetSuperTypes()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetTypeInfo
VirtualDatabaseWorkerThread.databaseMetaDataGetTypeInfo()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetUDTs
VirtualDatabaseWorkerThread.databaseMetaDataGetUDTs()
,
Constant Field Valuespublic static final int DatabaseMetaDataGetVersionColumns
DatabaseMetaData.getVersionColumns(java.lang.String,
java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int DatabaseStaticMetadata
~commandcode 80
~argument UTF: serialized DatabaseMetaData method call.
~reply Integer|Boolean|String|other ? value
VirtualDatabaseWorkerThread.databaseStaticMetadata()
,
Constant Field ValuesConstructor Detail |
public Commands()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |