| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| SapConnection |
|
| 1.075;1,075 |
| 1 | package net.sf.sapjcosupport.jdbc; |
|
| 2 | ||
| 3 | import com.sap.mw.jco.IRepository; |
|
| 4 | import com.sap.mw.jco.JCO; |
|
| 5 | import net.sf.sapjcosupport.SapDataSource; |
|
| 6 | import org.apache.log4j.Logger; |
|
| 7 | ||
| 8 | import java.sql.*; |
|
| 9 | import java.util.Map; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * Implements an SQL connection for SAP. |
|
| 13 | * |
|
| 14 | * @author Niki Driessen |
|
| 15 | */ |
|
| 16 | public class SapConnection implements java.sql.Connection { |
|
| 17 | 0 | private static final Logger logger = Logger.getLogger(SapConnection.class); |
| 18 | ||
| 19 | private JCO.Client nativeConnection; |
|
| 20 | private IRepository functionRepository; |
|
| 21 | ||
| 22 | public JCO.Client getNativeConnection() { |
|
| 23 | 0 | return nativeConnection; |
| 24 | } |
|
| 25 | ||
| 26 | public IRepository getFunctionRepository() { |
|
| 27 | 0 | return functionRepository; |
| 28 | } |
|
| 29 | ||
| 30 | 0 | public SapConnection(JCO.Client nativeConnection, IRepository functionRepository) { |
| 31 | 0 | this.nativeConnection = nativeConnection; |
| 32 | 0 | this.functionRepository = functionRepository; |
| 33 | 0 | } |
| 34 | ||
| 35 | /** |
|
| 36 | * Creates a <code>SapQLStatement</code> object for sending |
|
| 37 | * SQL statements to the database. |
|
| 38 | * SQL statements without parameters are normally |
|
| 39 | * executed using SapQLStatement objects. If the same SQL statement |
|
| 40 | * is executed many times, it is more efficient to use a |
|
| 41 | * <code>PreparedStatement</code> object. |
|
| 42 | * <p/> |
|
| 43 | * <p/> |
|
| 44 | * Result sets created using the returned <code>SapQLStatement</code> |
|
| 45 | * object will by default have forward-only type and read-only concurrency. |
|
| 46 | * |
|
| 47 | * @return a new SapQLStatement object |
|
| 48 | * @throws java.sql.SQLException if a database access error occurs |
|
| 49 | */ |
|
| 50 | public Statement createStatement() throws SQLException { |
|
| 51 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Creates a <code>PreparedStatement</code> object for sending |
|
| 56 | * parameterized SQL statements to the database. |
|
| 57 | * <p/> |
|
| 58 | * A SQL statement with or without IN parameters can be |
|
| 59 | * pre-compiled and stored in a PreparedStatement object. This |
|
| 60 | * object can then be used to efficiently execute this statement |
|
| 61 | * multiple times. |
|
| 62 | * <p/> |
|
| 63 | * <P><B>Note:</B> This method is optimized for handling |
|
| 64 | * parametric SQL statements that benefit from precompilation. If |
|
| 65 | * the driver supports precompilation, |
|
| 66 | * the method <code>prepareStatement</code> will send |
|
| 67 | * the statement to the database for precompilation. Some drivers |
|
| 68 | * may not support precompilation. In this case, the statement may |
|
| 69 | * not be sent to the database until the <code>PreparedStatement</code> is |
|
| 70 | * executed. This has no direct effect on users; however, it does |
|
| 71 | * affect which method throws certain SQLExceptions. |
|
| 72 | * <p/> |
|
| 73 | * <p/> |
|
| 74 | * Result sets created using the returned PreparedStatement will have |
|
| 75 | * forward-only type and read-only concurrency, by default. |
|
| 76 | * |
|
| 77 | * @param sql a SQL statement that may contain one or more '?' IN |
|
| 78 | * parameter placeholders |
|
| 79 | * @return a new PreparedStatement object containing the |
|
| 80 | * pre-compiled statement |
|
| 81 | * @throws java.sql.SQLException if a database access error occurs |
|
| 82 | */ |
|
| 83 | public PreparedStatement prepareStatement(String sql) throws SQLException { |
|
| 84 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Creates a <code>CallableStatement</code> object for calling |
|
| 89 | * database stored procedures. |
|
| 90 | * The <code>CallableStatement</code> object provides |
|
| 91 | * methods for setting up its IN and OUT parameters, and |
|
| 92 | * methods for executing the call to a stored procedure. |
|
| 93 | * <p/> |
|
| 94 | * <P><B>Note:</B> This method is optimized for handling stored |
|
| 95 | * procedure call statements. Some drivers may send the call |
|
| 96 | * statement to the database when the method <code>prepareCall</code> |
|
| 97 | * is done; others |
|
| 98 | * may wait until the <code>CallableStatement</code> object |
|
| 99 | * is executed. This has no |
|
| 100 | * direct effect on users; however, it does affect which method |
|
| 101 | * throws certain SQLExceptions. |
|
| 102 | * <p/> |
|
| 103 | * <p/> |
|
| 104 | * Result sets created using the returned CallableStatement will have |
|
| 105 | * forward-only type and read-only concurrency, by default. |
|
| 106 | * |
|
| 107 | * @param sql a SQL statement that may contain one or more '?' |
|
| 108 | * parameter placeholders. Typically this statement is a JDBC |
|
| 109 | * function call escape string. |
|
| 110 | * @return a new CallableStatement object containing the |
|
| 111 | * pre-compiled SQL statement |
|
| 112 | * @throws java.sql.SQLException if a database access error occurs |
|
| 113 | */ |
|
| 114 | public CallableStatement prepareCall(String sql) throws SQLException { |
|
| 115 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * Converts the given SQL statement into the system's native SQL grammar. |
|
| 120 | * A driver may convert the JDBC sql grammar into its system's |
|
| 121 | * native SQL grammar prior to sending it; this method returns the |
|
| 122 | * native form of the statement that the driver would have sent. |
|
| 123 | * |
|
| 124 | * @param sql a SQL statement that may contain one or more '?' |
|
| 125 | * parameter placeholders |
|
| 126 | * @return the native form of this statement |
|
| 127 | * @throws java.sql.SQLException if a database access error occurs |
|
| 128 | */ |
|
| 129 | public String nativeSQL(String sql) throws SQLException { |
|
| 130 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Sets this connection's auto-commit mode. |
|
| 135 | * If a connection is in auto-commit mode, then all its SQL |
|
| 136 | * statements will be executed and committed as individual |
|
| 137 | * transactions. Otherwise, its SQL statements are grouped into |
|
| 138 | * transactions that are terminated by a call to either |
|
| 139 | * the method <code>commit</code> or the method <code>rollback</code>. |
|
| 140 | * By default, new connections are in auto-commit |
|
| 141 | * mode. |
|
| 142 | * <p/> |
|
| 143 | * The commit occurs when the statement completes or the next |
|
| 144 | * execute occurs, whichever comes first. In the case of |
|
| 145 | * statements returning a ResultSet, the statement completes when |
|
| 146 | * the last row of the ResultSet has been retrieved or the |
|
| 147 | * ResultSet has been closed. In advanced cases, a single |
|
| 148 | * statement may return multiple results as well as output |
|
| 149 | * parameter values. In these cases the commit occurs when all results and |
|
| 150 | * output parameter values have been retrieved. |
|
| 151 | * |
|
| 152 | * @param autoCommit true enables auto-commit; false disables |
|
| 153 | * auto-commit. |
|
| 154 | * @throws java.sql.SQLException if a database access error occurs |
|
| 155 | */ |
|
| 156 | public void setAutoCommit(boolean autoCommit) throws SQLException { |
|
| 157 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 158 | 0 | } |
| 159 | ||
| 160 | /** |
|
| 161 | * Gets the current auto-commit state. |
|
| 162 | * |
|
| 163 | * @return the current state of auto-commit mode |
|
| 164 | * @throws java.sql.SQLException if a database access error occurs |
|
| 165 | * @see #setAutoCommit |
|
| 166 | */ |
|
| 167 | public boolean getAutoCommit() throws SQLException { |
|
| 168 | 0 | return false; //To change body of implemented methods use File | Settings | File Templates. |
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Makes all changes made since the previous |
|
| 173 | * commit/rollback permanent and releases any database locks |
|
| 174 | * currently held by the SapConnection. This method should be |
|
| 175 | * used only when auto-commit mode has been disabled. |
|
| 176 | * |
|
| 177 | * @throws java.sql.SQLException if a database access error occurs |
|
| 178 | * @see #setAutoCommit |
|
| 179 | */ |
|
| 180 | public void commit() throws SQLException { |
|
| 181 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 182 | 0 | } |
| 183 | ||
| 184 | /** |
|
| 185 | * Drops all changes made since the previous |
|
| 186 | * commit/rollback and releases any database locks currently held |
|
| 187 | * by this SapConnection. This method should be used only when auto- |
|
| 188 | * commit has been disabled. |
|
| 189 | * |
|
| 190 | * @throws java.sql.SQLException if a database access error occurs |
|
| 191 | * @see #setAutoCommit |
|
| 192 | */ |
|
| 193 | public void rollback() throws SQLException { |
|
| 194 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 195 | 0 | } |
| 196 | ||
| 197 | /** |
|
| 198 | * Releases a SapConnection's database and JDBC resources |
|
| 199 | * immediately instead of waiting for |
|
| 200 | * them to be automatically released. |
|
| 201 | * <p/> |
|
| 202 | * <P><B>Note:</B> A Connection is automatically closed when it is |
|
| 203 | * garbage collected. Certain fatal errors also result in a closed |
|
| 204 | * Connection. |
|
| 205 | * |
|
| 206 | * @throws java.sql.SQLException if a database access error occurs |
|
| 207 | */ |
|
| 208 | public void close() throws SQLException { |
|
| 209 | try { |
|
| 210 | 0 | JCO.releaseClient(nativeConnection); |
| 211 | 0 | } catch (Exception e) { |
| 212 | try { |
|
| 213 | 0 | nativeConnection.reset(); |
| 214 | 0 | JCO.releaseClient(nativeConnection); |
| 215 | 0 | } catch (Exception e1) { |
| 216 | 0 | logger.warn("Error closing native SAP connection", e1); |
| 217 | 0 | } |
| 218 | 0 | } |
| 219 | 0 | } |
| 220 | ||
| 221 | /** |
|
| 222 | * Called by the garbage collector on an object when garbage collection |
|
| 223 | * determines that there are no more references to the object. |
|
| 224 | * A subclass overrides the <code>finalize</code> method to dispose of |
|
| 225 | * system resources or to perform other cleanup. |
|
| 226 | * <p/> |
|
| 227 | * The general contract of <tt>finalize</tt> is that it is invoked |
|
| 228 | * if and when the Java<font size="-2"><sup>TM</sup></font> virtual |
|
| 229 | * machine has determined that there is no longer any |
|
| 230 | * means by which this object can be accessed by any thread that has |
|
| 231 | * not yet died, except as a result of an action taken by the |
|
| 232 | * finalization of some other object or class which is ready to be |
|
| 233 | * finalized. The <tt>finalize</tt> method may take any action, including |
|
| 234 | * making this object available again to other threads; the usual purpose |
|
| 235 | * of <tt>finalize</tt>, however, is to perform cleanup actions before |
|
| 236 | * the object is irrevocably discarded. For example, the finalize method |
|
| 237 | * for an object that represents an input/output connection might perform |
|
| 238 | * explicit I/O transactions to break the connection before the object is |
|
| 239 | * permanently discarded. |
|
| 240 | * <p/> |
|
| 241 | * The <tt>finalize</tt> method of class <tt>Object</tt> performs no |
|
| 242 | * special action; it simply returns normally. Subclasses of |
|
| 243 | * <tt>Object</tt> may override this definition. |
|
| 244 | * <p/> |
|
| 245 | * The Java programming language does not guarantee which thread will |
|
| 246 | * invoke the <tt>finalize</tt> method for any given object. It is |
|
| 247 | * guaranteed, however, that the thread that invokes finalize will not |
|
| 248 | * be holding any user-visible synchronization locks when finalize is |
|
| 249 | * invoked. If an uncaught exception is thrown by the finalize method, |
|
| 250 | * the exception is ignored and finalization of that object terminates. |
|
| 251 | * <p/> |
|
| 252 | * After the <tt>finalize</tt> method has been invoked for an object, no |
|
| 253 | * further action is taken until the Java virtual machine has again |
|
| 254 | * determined that there is no longer any means by which this object can |
|
| 255 | * be accessed by any thread that has not yet died, including possible |
|
| 256 | * actions by other objects or classes which are ready to be finalized, |
|
| 257 | * at which point the object may be discarded. |
|
| 258 | * <p/> |
|
| 259 | * The <tt>finalize</tt> method is never invoked more than once by a Java |
|
| 260 | * virtual machine for any given object. |
|
| 261 | * <p/> |
|
| 262 | * Any exception thrown by the <code>finalize</code> method causes |
|
| 263 | * the finalization of this object to be halted, but is otherwise |
|
| 264 | * ignored. |
|
| 265 | * |
|
| 266 | * @throws Throwable the <code>Exception</code> raised by this method |
|
| 267 | */ |
|
| 268 | protected void finalize() throws Throwable { |
|
| 269 | try { |
|
| 270 | 0 | close(); |
| 271 | } finally { |
|
| 272 | 0 | super.finalize(); |
| 273 | 0 | } |
| 274 | 0 | } |
| 275 | ||
| 276 | /** |
|
| 277 | * Tests to see if a SapConnection is closed. |
|
| 278 | * |
|
| 279 | * @return true if the connection is closed; false if it's still open |
|
| 280 | * @throws java.sql.SQLException if a database access error occurs |
|
| 281 | */ |
|
| 282 | public boolean isClosed() throws SQLException { |
|
| 283 | 0 | return !(nativeConnection.isAlive() && nativeConnection.isValid()); |
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| 287 | * Gets the metadata regarding this connection's database. |
|
| 288 | * A SapConnection's database is able to provide information |
|
| 289 | * describing its tables, its supported SQL grammar, its stored |
|
| 290 | * procedures, the capabilities of this connection, and so on. This |
|
| 291 | * information is made available through a DatabaseMetaData |
|
| 292 | * object. |
|
| 293 | * |
|
| 294 | * @return a DatabaseMetaData object for this SapConnection |
|
| 295 | * @throws java.sql.SQLException if a database access error occurs |
|
| 296 | */ |
|
| 297 | public DatabaseMetaData getMetaData() throws SQLException { |
|
| 298 | 0 | throw new JdbcFeatureNotSupportedException(); |
| 299 | } |
|
| 300 | ||
| 301 | /** |
|
| 302 | * Puts this connection in read-only mode as a hint to enable |
|
| 303 | * database optimizations. |
|
| 304 | * <p/> |
|
| 305 | * <P><B>Note:</B> This method cannot be called while in the |
|
| 306 | * middle of a transaction. |
|
| 307 | * |
|
| 308 | * @param readOnly true enables read-only mode; false disables |
|
| 309 | * read-only mode. |
|
| 310 | * @throws java.sql.SQLException if a database access error occurs |
|
| 311 | */ |
|
| 312 | public void setReadOnly(boolean readOnly) throws SQLException { |
|
| 313 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 314 | 0 | } |
| 315 | ||
| 316 | /** |
|
| 317 | * Tests to see if the connection is in read-only mode. |
|
| 318 | * |
|
| 319 | * @return true if connection is read-only and false otherwise |
|
| 320 | * @throws java.sql.SQLException if a database access error occurs |
|
| 321 | */ |
|
| 322 | public boolean isReadOnly() throws SQLException { |
|
| 323 | 0 | return false; //To change body of implemented methods use File | Settings | File Templates. |
| 324 | } |
|
| 325 | ||
| 326 | /** |
|
| 327 | * Sets a catalog name in order to select |
|
| 328 | * a subspace of this SapConnection's database in which to work. |
|
| 329 | * If the driver does not support catalogs, it will |
|
| 330 | * silently ignore this request. |
|
| 331 | * |
|
| 332 | * @throws java.sql.SQLException if a database access error occurs |
|
| 333 | */ |
|
| 334 | public void setCatalog(String catalog) throws SQLException { |
|
| 335 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 336 | 0 | } |
| 337 | ||
| 338 | /** |
|
| 339 | * Returns the Connection's current catalog name. |
|
| 340 | * |
|
| 341 | * @return the current catalog name or null |
|
| 342 | * @throws java.sql.SQLException if a database access error occurs |
|
| 343 | */ |
|
| 344 | public String getCatalog() throws SQLException { |
|
| 345 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 346 | } |
|
| 347 | ||
| 348 | /** |
|
| 349 | * Attempts to change the transaction |
|
| 350 | * isolation level to the one given. |
|
| 351 | * The constants defined in the interface <code>Connection</code> |
|
| 352 | * are the possible transaction isolation levels. |
|
| 353 | * <p/> |
|
| 354 | * <P><B>Note:</B> This method cannot be called while |
|
| 355 | * in the middle of a transaction. |
|
| 356 | * |
|
| 357 | * @param level one of the TRANSACTION_* isolation values with the |
|
| 358 | * exception of TRANSACTION_NONE; some databases may not support |
|
| 359 | * other values |
|
| 360 | * @throws java.sql.SQLException if a database access error occurs |
|
| 361 | * @see java.sql.DatabaseMetaData#supportsTransactionIsolationLevel |
|
| 362 | */ |
|
| 363 | public void setTransactionIsolation(int level) throws SQLException { |
|
| 364 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 365 | 0 | } |
| 366 | ||
| 367 | /** |
|
| 368 | * Gets this SapConnection's current transaction isolation level. |
|
| 369 | * |
|
| 370 | * @return the current TRANSACTION_* mode value |
|
| 371 | * @throws java.sql.SQLException if a database access error occurs |
|
| 372 | */ |
|
| 373 | public int getTransactionIsolation() throws SQLException { |
|
| 374 | 0 | return 0; //To change body of implemented methods use File | Settings | File Templates. |
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * Returns the first warning reported by calls on this SapConnection. |
|
| 379 | * <p/> |
|
| 380 | * <P><B>Note:</B> Subsequent warnings will be chained to this |
|
| 381 | * SQLWarning. |
|
| 382 | * |
|
| 383 | * @return the first SQLWarning or null |
|
| 384 | * @throws java.sql.SQLException if a database access error occurs |
|
| 385 | */ |
|
| 386 | public SQLWarning getWarnings() throws SQLException { |
|
| 387 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 388 | } |
|
| 389 | ||
| 390 | /** |
|
| 391 | * Clears all warnings reported for this <code>SapConnection</code> object. |
|
| 392 | * After a call to this method, the method <code>getWarnings</code> |
|
| 393 | * returns null until a new warning is |
|
| 394 | * reported for this SapConnection. |
|
| 395 | * |
|
| 396 | * @throws java.sql.SQLException if a database access error occurs |
|
| 397 | */ |
|
| 398 | public void clearWarnings() throws SQLException { |
|
| 399 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 400 | 0 | } |
| 401 | ||
| 402 | /** |
|
| 403 | * Creates a <code>SapQLStatement</code> object that will generate |
|
| 404 | * <code>ResultSet</code> objects with the given type and concurrency. |
|
| 405 | * This method is the same as the <code>createStatement</code> method |
|
| 406 | * above, but it allows the default result set |
|
| 407 | * type and result set concurrency type to be overridden. |
|
| 408 | * |
|
| 409 | * @param resultSetType a result set type; see ResultSet.TYPE_XXX |
|
| 410 | * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX |
|
| 411 | * @return a new SapQLStatement object |
|
| 412 | * @throws java.sql.SQLException if a database access error occurs |
|
| 413 | * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a> |
|
| 414 | * @since 1.2 |
|
| 415 | */ |
|
| 416 | public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { |
|
| 417 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 418 | } |
|
| 419 | ||
| 420 | /** |
|
| 421 | * Creates a <code>PreparedStatement</code> object that will generate |
|
| 422 | * <code>ResultSet</code> objects with the given type and concurrency. |
|
| 423 | * This method is the same as the <code>prepareStatement</code> method |
|
| 424 | * above, but it allows the default result set |
|
| 425 | * type and result set concurrency type to be overridden. |
|
| 426 | * |
|
| 427 | * @param resultSetType a result set type; see ResultSet.TYPE_XXX |
|
| 428 | * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX |
|
| 429 | * @return a new PreparedStatement object containing the |
|
| 430 | * pre-compiled SQL statement |
|
| 431 | * @throws java.sql.SQLException if a database access error occurs |
|
| 432 | * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a> |
|
| 433 | * @since 1.2 |
|
| 434 | */ |
|
| 435 | public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws |
|
| 436 | SQLException { |
|
| 437 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 438 | } |
|
| 439 | ||
| 440 | /** |
|
| 441 | * Creates a <code>CallableStatement</code> object that will generate |
|
| 442 | * <code>ResultSet</code> objects with the given type and concurrency. |
|
| 443 | * This method is the same as the <code>prepareCall</code> method |
|
| 444 | * above, but it allows the default result set |
|
| 445 | * type and result set concurrency type to be overridden. |
|
| 446 | * |
|
| 447 | * @param resultSetType a result set type; see ResultSet.TYPE_XXX |
|
| 448 | * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX |
|
| 449 | * @return a new CallableStatement object containing the |
|
| 450 | * pre-compiled SQL statement |
|
| 451 | * @throws java.sql.SQLException if a database access error occurs |
|
| 452 | * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a> |
|
| 453 | * @since 1.2 |
|
| 454 | */ |
|
| 455 | public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { |
|
| 456 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 457 | } |
|
| 458 | ||
| 459 | /** |
|
| 460 | * Gets the type map object associated with this connection. |
|
| 461 | * Unless the application has added an entry to the type map, |
|
| 462 | * the map returned will be empty. |
|
| 463 | * |
|
| 464 | * @return the <code>java.util.Map</code> object associated |
|
| 465 | * with this <code>SapConnection</code> object |
|
| 466 | * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a> |
|
| 467 | * @since 1.2 |
|
| 468 | */ |
|
| 469 | public Map getTypeMap() throws SQLException { |
|
| 470 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 471 | } |
|
| 472 | ||
| 473 | /** |
|
| 474 | * Installs the given type map as the type map for |
|
| 475 | * this connection. The type map will be used for the |
|
| 476 | * custom mapping of SQL structured types and distinct types. |
|
| 477 | * |
|
| 478 | * @param map the <code>java.util.Map</code> object to install |
|
| 479 | * as the replacement for this <code>SapConnection</code> |
|
| 480 | * object's default type map |
|
| 481 | * @see <a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a> |
|
| 482 | * @since 1.2 |
|
| 483 | */ |
|
| 484 | public void setTypeMap(Map map) throws SQLException { |
|
| 485 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 486 | 0 | } |
| 487 | ||
| 488 | /** |
|
| 489 | * Retrieves the current holdability of <code>ResultSet</code> objects |
|
| 490 | * created using this <code>Connection</code> object. |
|
| 491 | * |
|
| 492 | * @return the holdability, one of |
|
| 493 | * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
|
| 494 | * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
|
| 495 | * @throws java.sql.SQLException if a database access occurs |
|
| 496 | * @see #setHoldability |
|
| 497 | * @see java.sql.ResultSet |
|
| 498 | * @since 1.4 |
|
| 499 | */ |
|
| 500 | public int getHoldability() throws SQLException { |
|
| 501 | 0 | return 0; //To change body of implemented methods use File | Settings | File Templates. |
| 502 | } |
|
| 503 | ||
| 504 | /** |
|
| 505 | * Changes the holdability of <code>ResultSet</code> objects |
|
| 506 | * created using this <code>Connection</code> object to the given |
|
| 507 | * holdability. |
|
| 508 | * |
|
| 509 | * @param holdability a <code>ResultSet</code> holdability constant; one of |
|
| 510 | * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
|
| 511 | * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
|
| 512 | * @throws java.sql.SQLException if a database access occurs, the given parameter |
|
| 513 | * is not a <code>ResultSet</code> constant indicating holdability, |
|
| 514 | * or the given holdability is not supported |
|
| 515 | * @see #getHoldability |
|
| 516 | * @see java.sql.ResultSet |
|
| 517 | * @since 1.4 |
|
| 518 | */ |
|
| 519 | public void setHoldability(int holdability) throws SQLException { |
|
| 520 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 521 | 0 | } |
| 522 | ||
| 523 | /** |
|
| 524 | * Creates an unnamed savepoint in the current transaction and |
|
| 525 | * returns the new <code>Savepoint</code> object that represents it. |
|
| 526 | * |
|
| 527 | * @return the new <code>Savepoint</code> object |
|
| 528 | * @throws java.sql.SQLException if a database access error occurs |
|
| 529 | * or this <code>Connection</code> object is currently in |
|
| 530 | * auto-commit mode |
|
| 531 | * @see java.sql.Savepoint |
|
| 532 | * @since 1.4 |
|
| 533 | */ |
|
| 534 | public Savepoint setSavepoint() throws SQLException { |
|
| 535 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 536 | } |
|
| 537 | ||
| 538 | /** |
|
| 539 | * Removes the given <code>Savepoint</code> object from the current |
|
| 540 | * transaction. Any reference to the savepoint after it have been removed |
|
| 541 | * will cause an <code>SQLException</code> to be thrown. |
|
| 542 | * |
|
| 543 | * @param savepoint the <code>Savepoint</code> object to be removed |
|
| 544 | * @throws java.sql.SQLException if a database access error occurs or |
|
| 545 | * the given <code>Savepoint</code> object is not a valid |
|
| 546 | * savepoint in the current transaction |
|
| 547 | * @since 1.4 |
|
| 548 | */ |
|
| 549 | public void releaseSavepoint(Savepoint savepoint) throws SQLException { |
|
| 550 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 551 | 0 | } |
| 552 | ||
| 553 | /** |
|
| 554 | * Undoes all changes made after the given <code>Savepoint</code> object |
|
| 555 | * was set. |
|
| 556 | * <p/> |
|
| 557 | * This method should be used only when auto-commit has been disabled. |
|
| 558 | * |
|
| 559 | * @param savepoint the <code>Savepoint</code> object to roll back to |
|
| 560 | * @throws java.sql.SQLException if a database access error occurs, |
|
| 561 | * the <code>Savepoint</code> object is no longer valid, |
|
| 562 | * or this <code>Connection</code> object is currently in |
|
| 563 | * auto-commit mode |
|
| 564 | * @see java.sql.Savepoint |
|
| 565 | * @see #rollback |
|
| 566 | * @since 1.4 |
|
| 567 | */ |
|
| 568 | public void rollback(Savepoint savepoint) throws SQLException { |
|
| 569 | //To change body of implemented methods use File | Settings | File Templates. |
|
| 570 | 0 | } |
| 571 | ||
| 572 | /** |
|
| 573 | * Creates a <code>Statement</code> object that will generate |
|
| 574 | * <code>ResultSet</code> objects with the given type, concurrency, |
|
| 575 | * and holdability. |
|
| 576 | * This method is the same as the <code>createStatement</code> method |
|
| 577 | * above, but it allows the default result set |
|
| 578 | * type, concurrency, and holdability to be overridden. |
|
| 579 | * |
|
| 580 | * @param resultSetType one of the following <code>ResultSet</code> |
|
| 581 | * constants: |
|
| 582 | * <code>ResultSet.TYPE_FORWARD_ONLY</code>, |
|
| 583 | * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or |
|
| 584 | * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> |
|
| 585 | * @param resultSetConcurrency one of the following <code>ResultSet</code> |
|
| 586 | * constants: |
|
| 587 | * <code>ResultSet.CONCUR_READ_ONLY</code> or |
|
| 588 | * <code>ResultSet.CONCUR_UPDATABLE</code> |
|
| 589 | * @param resultSetHoldability one of the following <code>ResultSet</code> |
|
| 590 | * constants: |
|
| 591 | * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
|
| 592 | * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
|
| 593 | * @return a new <code>Statement</code> object that will generate |
|
| 594 | * <code>ResultSet</code> objects with the given type, |
|
| 595 | * concurrency, and holdability |
|
| 596 | * @throws java.sql.SQLException if a database access error occurs |
|
| 597 | * or the given parameters are not <code>ResultSet</code> |
|
| 598 | * constants indicating type, concurrency, and holdability |
|
| 599 | * @see java.sql.ResultSet |
|
| 600 | * @since 1.4 |
|
| 601 | */ |
|
| 602 | public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws |
|
| 603 | SQLException { |
|
| 604 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 605 | } |
|
| 606 | ||
| 607 | /** |
|
| 608 | * Creates a <code>CallableStatement</code> object that will generate |
|
| 609 | * <code>ResultSet</code> objects with the given type and concurrency. |
|
| 610 | * This method is the same as the <code>prepareCall</code> method |
|
| 611 | * above, but it allows the default result set |
|
| 612 | * type, result set concurrency type and holdability to be overridden. |
|
| 613 | * |
|
| 614 | * @param sql a <code>String</code> object that is the SQL statement to |
|
| 615 | * be sent to the database; may contain on or more ? parameters |
|
| 616 | * @param resultSetType one of the following <code>ResultSet</code> |
|
| 617 | * constants: |
|
| 618 | * <code>ResultSet.TYPE_FORWARD_ONLY</code>, |
|
| 619 | * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or |
|
| 620 | * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> |
|
| 621 | * @param resultSetConcurrency one of the following <code>ResultSet</code> |
|
| 622 | * constants: |
|
| 623 | * <code>ResultSet.CONCUR_READ_ONLY</code> or |
|
| 624 | * <code>ResultSet.CONCUR_UPDATABLE</code> |
|
| 625 | * @param resultSetHoldability one of the following <code>ResultSet</code> |
|
| 626 | * constants: |
|
| 627 | * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
|
| 628 | * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
|
| 629 | * @return a new <code>CallableStatement</code> object, containing the |
|
| 630 | * pre-compiled SQL statement, that will generate |
|
| 631 | * <code>ResultSet</code> objects with the given type, |
|
| 632 | * concurrency, and holdability |
|
| 633 | * @throws java.sql.SQLException if a database access error occurs |
|
| 634 | * or the given parameters are not <code>ResultSet</code> |
|
| 635 | * constants indicating type, concurrency, and holdability |
|
| 636 | * @see java.sql.ResultSet |
|
| 637 | * @since 1.4 |
|
| 638 | */ |
|
| 639 | public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, |
|
| 640 | int resultSetHoldability) throws SQLException { |
|
| 641 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 642 | } |
|
| 643 | ||
| 644 | /** |
|
| 645 | * Creates a default <code>PreparedStatement</code> object that has |
|
| 646 | * the capability to retrieve auto-generated keys. The given constant |
|
| 647 | * tells the driver whether it should make auto-generated keys |
|
| 648 | * available for retrieval. This parameter is ignored if the SQL |
|
| 649 | * statement is not an <code>INSERT</code> statement. |
|
| 650 | * <p/> |
|
| 651 | * <B>Note:</B> This method is optimized for handling |
|
| 652 | * parametric SQL statements that benefit from precompilation. If |
|
| 653 | * the driver supports precompilation, |
|
| 654 | * the method <code>prepareStatement</code> will send |
|
| 655 | * the statement to the database for precompilation. Some drivers |
|
| 656 | * may not support precompilation. In this case, the statement may |
|
| 657 | * not be sent to the database until the <code>PreparedStatement</code> |
|
| 658 | * object is executed. This has no direct effect on users; however, it does |
|
| 659 | * affect which methods throw certain SQLExceptions. |
|
| 660 | * <p/> |
|
| 661 | * Result sets created using the returned <code>PreparedStatement</code> |
|
| 662 | * object will by default be type <code>TYPE_FORWARD_ONLY</code> |
|
| 663 | * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. |
|
| 664 | * |
|
| 665 | * @param sql an SQL statement that may contain one or more '?' IN |
|
| 666 | * parameter placeholders |
|
| 667 | * @param autoGeneratedKeys a flag indicating whether auto-generated keys |
|
| 668 | * should be returned; one of |
|
| 669 | * <code>Statement.RETURN_GENERATED_KEYS</code> or |
|
| 670 | * <code>Statement.NO_GENERATED_KEYS</code> |
|
| 671 | * @return a new <code>PreparedStatement</code> object, containing the |
|
| 672 | * pre-compiled SQL statement, that will have the capability of |
|
| 673 | * returning auto-generated keys |
|
| 674 | * @throws java.sql.SQLException if a database access error occurs |
|
| 675 | * or the given parameter is not a <code>Statement</code> |
|
| 676 | * constant indicating whether auto-generated keys should be |
|
| 677 | * returned |
|
| 678 | * @since 1.4 |
|
| 679 | */ |
|
| 680 | public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { |
|
| 681 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 682 | } |
|
| 683 | ||
| 684 | /** |
|
| 685 | * Creates a <code>PreparedStatement</code> object that will generate |
|
| 686 | * <code>ResultSet</code> objects with the given type, concurrency, |
|
| 687 | * and holdability. |
|
| 688 | * <p/> |
|
| 689 | * This method is the same as the <code>prepareStatement</code> method |
|
| 690 | * above, but it allows the default result set |
|
| 691 | * type, concurrency, and holdability to be overridden. |
|
| 692 | * |
|
| 693 | * @param sql a <code>String</code> object that is the SQL statement to |
|
| 694 | * be sent to the database; may contain one or more ? IN |
|
| 695 | * parameters |
|
| 696 | * @param resultSetType one of the following <code>ResultSet</code> |
|
| 697 | * constants: |
|
| 698 | * <code>ResultSet.TYPE_FORWARD_ONLY</code>, |
|
| 699 | * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or |
|
| 700 | * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> |
|
| 701 | * @param resultSetConcurrency one of the following <code>ResultSet</code> |
|
| 702 | * constants: |
|
| 703 | * <code>ResultSet.CONCUR_READ_ONLY</code> or |
|
| 704 | * <code>ResultSet.CONCUR_UPDATABLE</code> |
|
| 705 | * @param resultSetHoldability one of the following <code>ResultSet</code> |
|
| 706 | * constants: |
|
| 707 | * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
|
| 708 | * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
|
| 709 | * @return a new <code>PreparedStatement</code> object, containing the |
|
| 710 | * pre-compiled SQL statement, that will generate |
|
| 711 | * <code>ResultSet</code> objects with the given type, |
|
| 712 | * concurrency, and holdability |
|
| 713 | * @throws java.sql.SQLException if a database access error occurs |
|
| 714 | * or the given parameters are not <code>ResultSet</code> |
|
| 715 | * constants indicating type, concurrency, and holdability |
|
| 716 | * @see java.sql.ResultSet |
|
| 717 | * @since 1.4 |
|
| 718 | */ |
|
| 719 | public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, |
|
| 720 | int resultSetHoldability) throws SQLException { |
|
| 721 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 722 | } |
|
| 723 | ||
| 724 | /** |
|
| 725 | * Creates a default <code>PreparedStatement</code> object capable |
|
| 726 | * of returning the auto-generated keys designated by the given array. |
|
| 727 | * This array contains the indexes of the columns in the target |
|
| 728 | * table that contain the auto-generated keys that should be made |
|
| 729 | * available. This array is ignored if the SQL |
|
| 730 | * statement is not an <code>INSERT</code> statement. |
|
| 731 | * <p/> |
|
| 732 | * An SQL statement with or without IN parameters can be |
|
| 733 | * pre-compiled and stored in a <code>PreparedStatement</code> object. This |
|
| 734 | * object can then be used to efficiently execute this statement |
|
| 735 | * multiple times. |
|
| 736 | * <p/> |
|
| 737 | * <B>Note:</B> This method is optimized for handling |
|
| 738 | * parametric SQL statements that benefit from precompilation. If |
|
| 739 | * the driver supports precompilation, |
|
| 740 | * the method <code>prepareStatement</code> will send |
|
| 741 | * the statement to the database for precompilation. Some drivers |
|
| 742 | * may not support precompilation. In this case, the statement may |
|
| 743 | * not be sent to the database until the <code>PreparedStatement</code> |
|
| 744 | * object is executed. This has no direct effect on users; however, it does |
|
| 745 | * affect which methods throw certain SQLExceptions. |
|
| 746 | * <p/> |
|
| 747 | * Result sets created using the returned <code>PreparedStatement</code> |
|
| 748 | * object will by default be type <code>TYPE_FORWARD_ONLY</code> |
|
| 749 | * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. |
|
| 750 | * |
|
| 751 | * @param sql an SQL statement that may contain one or more '?' IN |
|
| 752 | * parameter placeholders |
|
| 753 | * @param columnIndexes an array of column indexes indicating the columns |
|
| 754 | * that should be returned from the inserted row or rows |
|
| 755 | * @return a new <code>PreparedStatement</code> object, containing the |
|
| 756 | * pre-compiled statement, that is capable of returning the |
|
| 757 | * auto-generated keys designated by the given array of column |
|
| 758 | * indexes |
|
| 759 | * @throws java.sql.SQLException if a database access error occurs |
|
| 760 | * @since 1.4 |
|
| 761 | */ |
|
| 762 | public PreparedStatement prepareStatement(String sql, int columnIndexes[]) throws SQLException { |
|
| 763 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 764 | } |
|
| 765 | ||
| 766 | /** |
|
| 767 | * Creates a savepoint with the given name in the current transaction |
|
| 768 | * and returns the new <code>Savepoint</code> object that represents it. |
|
| 769 | * |
|
| 770 | * @param name a <code>String</code> containing the name of the savepoint |
|
| 771 | * @return the new <code>Savepoint</code> object |
|
| 772 | * @throws java.sql.SQLException if a database access error occurs |
|
| 773 | * or this <code>Connection</code> object is currently in |
|
| 774 | * auto-commit mode |
|
| 775 | * @see java.sql.Savepoint |
|
| 776 | * @since 1.4 |
|
| 777 | */ |
|
| 778 | public Savepoint setSavepoint(String name) throws SQLException { |
|
| 779 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 780 | } |
|
| 781 | ||
| 782 | /** |
|
| 783 | * Creates a default <code>PreparedStatement</code> object capable |
|
| 784 | * of returning the auto-generated keys designated by the given array. |
|
| 785 | * This array contains the names of the columns in the target |
|
| 786 | * table that contain the auto-generated keys that should be returned. |
|
| 787 | * This array is ignored if the SQL |
|
| 788 | * statement is not an <code>INSERT</code> statement. |
|
| 789 | * <p/> |
|
| 790 | * An SQL statement with or without IN parameters can be |
|
| 791 | * pre-compiled and stored in a <code>PreparedStatement</code> object. This |
|
| 792 | * object can then be used to efficiently execute this statement |
|
| 793 | * multiple times. |
|
| 794 | * <p/> |
|
| 795 | * <B>Note:</B> This method is optimized for handling |
|
| 796 | * parametric SQL statements that benefit from precompilation. If |
|
| 797 | * the driver supports precompilation, |
|
| 798 | * the method <code>prepareStatement</code> will send |
|
| 799 | * the statement to the database for precompilation. Some drivers |
|
| 800 | * may not support precompilation. In this case, the statement may |
|
| 801 | * not be sent to the database until the <code>PreparedStatement</code> |
|
| 802 | * object is executed. This has no direct effect on users; however, it does |
|
| 803 | * affect which methods throw certain SQLExceptions. |
|
| 804 | * <p/> |
|
| 805 | * Result sets created using the returned <code>PreparedStatement</code> |
|
| 806 | * object will by default be type <code>TYPE_FORWARD_ONLY</code> |
|
| 807 | * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. |
|
| 808 | * |
|
| 809 | * @param sql an SQL statement that may contain one or more '?' IN |
|
| 810 | * parameter placeholders |
|
| 811 | * @param columnNames an array of column names indicating the columns |
|
| 812 | * that should be returned from the inserted row or rows |
|
| 813 | * @return a new <code>PreparedStatement</code> object, containing the |
|
| 814 | * pre-compiled statement, that is capable of returning the |
|
| 815 | * auto-generated keys designated by the given array of column |
|
| 816 | * names |
|
| 817 | * @throws java.sql.SQLException if a database access error occurs |
|
| 818 | * @since 1.4 |
|
| 819 | */ |
|
| 820 | public PreparedStatement prepareStatement(String sql, String columnNames[]) throws SQLException { |
|
| 821 | 0 | return null; //To change body of implemented methods use File | Settings | File Templates. |
| 822 | } |
|
| 823 | } |