00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2002-2005 French National Institute For Research In Computer 00004 * Science And Control (INRIA). 00005 * Contact: c-jdbc@objectweb.org 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published by the 00009 * Free Software Foundation; either version 2.1 of the License, or any later 00010 * version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00015 * for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 * 00021 * Initial developer(s): Emmanuel Cecchet. 00022 * Contributor(s): Nicolas Modrzyk. 00023 */ 00024 00025 package org.objectweb.cjdbc.driver.protocol; 00026 00027 /** 00028 * Commands used by the protocol between the C-JDBC driver and controller. 00029 * 00030 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00031 * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>* 00032 * @version 1.0 00033 */ 00034 public class Commands 00035 { 00036 /** 00037 * Protocol version to check that driver is compatible with controller. 00038 * Increase this number each time the exchange protocol changes between driver 00039 * and controller. 00040 */ 00041 public static final int ProtocolVersion = 15; 00042 00043 /* 00044 * SQL requests handling 00045 */ 00046 00047 /** 00048 * Performs a read request and returns the reply. 00049 * 00050 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#execReadRequest(org.objectweb.cjdbc.common.sql.SelectRequest) 00051 */ 00052 public static final int ExecReadRequest = 0; 00053 00054 /** 00055 * Performs a write request and returns the number of rows affected. 00056 * 00057 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#execWriteRequest(org.objectweb.cjdbc.common.sql.AbstractWriteRequest) 00058 */ 00059 public static final int ExecWriteRequest = 1; 00060 00061 /** 00062 * Performs a write request and returns the auto generated keys. 00063 * 00064 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#execWriteRequestWithKeys(org.objectweb.cjdbc.common.sql.AbstractWriteRequest) 00065 */ 00066 public static final int ExecWriteRequestWithKeys = 2; 00067 00068 /** 00069 * Calls a stored procedure and returns the reply (ResultSet). 00070 * 00071 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#execReadStoredProcedure(org.objectweb.cjdbc.common.sql.StoredProcedure) 00072 */ 00073 public static final int ExecReadStoredProcedure = 3; 00074 00075 /** 00076 * Calls a stored procedure and returns the number of rows affected (write 00077 * query). 00078 * 00079 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#execReadStoredProcedure(org.objectweb.cjdbc.common.sql.StoredProcedure) 00080 */ 00081 public static final int ExecWriteStoredProcedure = 4; 00082 00083 /** 00084 * Create Request. This is used when sending a write request from the driver 00085 * to the database worker thread 00086 */ 00087 public static final int CreateRequest = 5; 00088 /** 00089 * Delete Request. This is used when sending a write request from the driver 00090 * to the database worker thread 00091 */ 00092 public static final int DeleteRequest = 6; 00093 /** 00094 * Drop Request. This is used when sending a write request from the driver to 00095 * the database worker thread 00096 */ 00097 public static final int DropRequest = 7; 00098 /** 00099 * Insert Request. This is used when sending a write request from the driver 00100 * to the database worker thread 00101 */ 00102 public static final int InsertRequest = 8; 00103 /** 00104 * Update Request. This is used when sending a write request from the driver 00105 * to the database worker thread 00106 */ 00107 public static final int UpdateRequest = 9; 00108 00109 /** 00110 * Alter Request. This is used when sending a write request from the driver to 00111 * the database worker thread 00112 */ 00113 public static final int AlterRequest = 10; 00114 00115 /* 00116 * Transaction management 00117 */ 00118 00119 /** 00120 * Begins a new transaction and returns the corresponding transaction 00121 * identifier. This method is called from the driver when 00122 * {@link org.objectweb.cjdbc.driver.Connection#setAutoCommit(boolean)}is 00123 * called with <code>false</code> argument. 00124 * 00125 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#begin(String) 00126 */ 00127 public static final int Begin = 20; 00128 00129 /** 00130 * Commits a transaction given its id. 00131 * 00132 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#commit(long) 00133 */ 00134 public static final int Commit = 21; 00135 00136 /** 00137 * Rollbacks a transaction given its id. 00138 * 00139 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#rollback(long) 00140 */ 00141 public static final int Rollback = 22; 00142 00143 /* 00144 * Connection management 00145 */ 00146 00147 /** 00148 * Close the connection 00149 */ 00150 public static final int Close = 30; 00151 00152 /** 00153 * Reset the connection 00154 */ 00155 public static final int Reset = 31; 00156 00157 /** 00158 * Fetch next rows of data for ResultSet streaming 00159 */ 00160 public static final int FetchNextResultSetRows = 32; 00161 00162 /** 00163 * Closes a remote ResultSet that was opened for streaming. 00164 */ 00165 public static final int CloseRemoteResultSet = 33; 00166 00167 /** 00168 * Restore a connection state after an automatic reconnection. 00169 */ 00170 public static final int RestoreConnectionState = 34; 00171 00172 /** 00173 * Command to change the autocommit value from false to true. We want to 00174 * commit the current transaction but we don't want to start a new one. 00175 */ 00176 public static final int SetAutoCommit = 35; 00177 00178 /** 00179 * Retrieve the current catalog 00180 * 00181 * @see org.objectweb.cjdbc.driver.Connection#getCatalog() 00182 */ 00183 public static final int ConnectionGetCatalog = 36; 00184 00185 /** 00186 * Retrieve the current catalog 00187 * 00188 * @see org.objectweb.cjdbc.driver.Connection#getCatalogs() 00189 */ 00190 public static final int ConnectionGetCatalogs = 37; 00191 00192 /** 00193 * Change the current connection catalog 00194 * 00195 * @see org.objectweb.cjdbc.driver.Connection#setCatalog(String) 00196 */ 00197 public static final int ConnectionSetCatalog = 38; 00198 00199 /* 00200 * MetaData functions 00201 */ 00202 00203 /** 00204 * Gets the virtual database name to be used by the client (C-JDBC driver). 00205 * 00206 * @see org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase#getVirtualDatabaseName() 00207 */ 00208 public static final int GetVirtualDatabaseName = 50; 00209 00210 /** 00211 * Gets the controller version number. 00212 * 00213 * @see org.objectweb.cjdbc.controller.core.Controller#getVersionNumber() 00214 */ 00215 public static final int GetControllerVersionNumber = 51; 00216 00217 /** 00218 * Used to get the schema tables by calling DatabaseMetaData.getTables() 00219 * 00220 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTables(String, String, 00221 * String, String[]) 00222 */ 00223 public static final int DatabaseMetaDataGetTables = 52; 00224 00225 /** 00226 * Used to get the schema columns by calling DatabaseMetaData.getColumns() 00227 * 00228 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getColumns(String, String, 00229 * String, String) 00230 */ 00231 public static final int DatabaseMetaDataGetColumns = 53; 00232 00233 /** 00234 * Used to get the schema primary keys by calling 00235 * DatabaseMetaData.getColumns() 00236 * 00237 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getPrimaryKeys(String, 00238 * String, String) 00239 */ 00240 public static final int DatabaseMetaDataGetPrimaryKeys = 54; 00241 00242 /** 00243 * Used to get the schema procedures by calling 00244 * DatabaseMetaData.getProcedures() 00245 * 00246 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getProcedures(String, 00247 * String, String) 00248 */ 00249 public static final int DatabaseMetaDataGetProcedures = 55; 00250 00251 /** 00252 * Used to get the schema procedure columns by calling 00253 * DatabaseMetaData.getProcedureColumns() 00254 * 00255 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getProcedureColumns(String, 00256 * String, String, String) 00257 */ 00258 public static final int DatabaseMetaDataGetProcedureColumns = 56; 00259 00260 /** 00261 * Retrieve the database table types 00262 * 00263 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTableTypes() 00264 */ 00265 public static final int DatabaseMetaDataGetTableTypes = 58; 00266 00267 /** 00268 * Retrieve the table privileges 00269 * 00270 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getTablePrivileges(String, 00271 * String, String) 00272 */ 00273 public static final int DatabaseMetaDataGetTablePrivileges = 59; 00274 00275 /** 00276 * Retrieve the schemas 00277 * 00278 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getSchemas() 00279 */ 00280 public static final int DatabaseMetaDataGetSchemas = 60; 00281 00282 /** 00283 * Retrieve the list of database product names 00284 * 00285 * @see org.objectweb.cjdbc.driver.DatabaseMetaData#getDatabaseProductName() 00286 */ 00287 public static final int DatabaseMetaDataGetDatabaseProductName = 61; 00288 00289 /** 00290 * Retrieve an object containing all the static metadata. This includes all the boolean values 00291 * collected from an underlying backend to the controller. 00292 */ 00293 public static final int DatabaseStaticMetadata = 62; 00294 00295 }