1 2 11 12 package org.objectweb.rmijdbc; 13 14 import java.sql.*; 15 import java.rmi.*; 16 import java.rmi.server.UnicastRemoteObject ; 17 import java.rmi.server.Unreferenced ; 18 19 32 public class RJStatementServer 33 extends UnicastRemoteObject 34 implements RJStatementInterface, Unreferenced { 35 36 java.sql.Statement jdbcStatement_; 37 38 public RJStatementServer(java.sql.Statement s) 39 throws java.rmi.RemoteException { 40 super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); 41 jdbcStatement_ = s; 42 } 43 44 public void unreferenced() 45 { 46 Runtime.getRuntime().gc(); 47 } 48 49 protected void finalize() throws Throwable { 50 if (jdbcStatement_ != null) jdbcStatement_.close(); 51 Runtime.getRuntime().gc(); 52 } 53 54 55 62 public RJResultSetInterface executeQuery(String sql) 63 throws java.rmi.RemoteException , SQLException { 64 return new RJResultSetServer(jdbcStatement_.executeQuery(sql)); 65 } 66 67 77 public int executeUpdate(String sql) throws java.rmi.RemoteException , 78 SQLException { 79 return jdbcStatement_.executeUpdate(sql); 80 } 81 82 92 public void close() throws java.rmi.RemoteException , SQLException { 93 if(jdbcStatement_ != null) jdbcStatement_.close(); 94 } 95 96 98 107 public int getMaxFieldSize() throws java.rmi.RemoteException , SQLException { 108 return jdbcStatement_.getMaxFieldSize(); 109 } 110 111 121 public void setMaxFieldSize(int max) throws java.rmi.RemoteException , SQLException { 122 jdbcStatement_.setMaxFieldSize(max); 123 } 124 125 132 public int getMaxRows() throws java.rmi.RemoteException , SQLException { 133 return jdbcStatement_.getMaxRows(); 134 } 135 136 143 public void setMaxRows(int max) throws java.rmi.RemoteException , SQLException { 144 jdbcStatement_.setMaxRows(max); 145 } 146 147 153 public void setEscapeProcessing(boolean enable) 154 throws java.rmi.RemoteException , SQLException { 155 jdbcStatement_.setEscapeProcessing(enable); 156 } 157 158 165 public int getQueryTimeout() throws java.rmi.RemoteException , SQLException { 166 return jdbcStatement_.getQueryTimeout(); 167 } 168 169 176 public void setQueryTimeout(int seconds) throws java.rmi.RemoteException , SQLException { 177 jdbcStatement_.setQueryTimeout(seconds); 178 } 179 180 184 public void cancel() throws java.rmi.RemoteException , SQLException { 185 jdbcStatement_.cancel(); 186 } 187 188 203 public SQLWarning getWarnings() throws java.rmi.RemoteException , SQLException { 204 return jdbcStatement_.getWarnings(); 205 } 206 207 211 public void clearWarnings() throws java.rmi.RemoteException , SQLException { 212 jdbcStatement_.clearWarnings(); 213 } 214 215 230 public void setCursorName(String name) throws java.rmi.RemoteException , SQLException { 231 jdbcStatement_.setCursorName(name); 232 } 233 234 236 257 public boolean execute(String sql) throws java.rmi.RemoteException , SQLException { 258 return jdbcStatement_.execute(sql); 259 } 260 261 269 public RJResultSetInterface getResultSet() 270 throws java.rmi.RemoteException , SQLException { 271 272 RJResultSetServer rsServer = null; 273 274 ResultSet rs = jdbcStatement_.getResultSet(); 275 276 if (rs != null) { 280 rsServer = new RJResultSetServer(rs); 281 } 282 283 return rsServer; 284 } 285 286 295 public int getUpdateCount() throws java.rmi.RemoteException , SQLException { 296 return jdbcStatement_.getUpdateCount(); 297 } 298 299 311 public boolean getMoreResults() 312 throws java.rmi.RemoteException , SQLException { 313 return jdbcStatement_.getMoreResults(); 314 } 315 316 public void setFetchSize(int rows) throws RemoteException, SQLException { 318 jdbcStatement_.setFetchSize(rows); 319 } 320 321 public void setFetchDirection(int dir) throws RemoteException, SQLException { 322 jdbcStatement_.setFetchDirection(dir); 323 } 324 325 public int getResultSetType() throws RemoteException, SQLException { 326 return jdbcStatement_.getResultSetType(); 327 } 328 329 public int getResultSetConcurrency() throws RemoteException, SQLException { 330 return jdbcStatement_.getResultSetConcurrency(); 331 } 332 333 public int getFetchSize() throws RemoteException, SQLException { 334 return jdbcStatement_.getFetchSize(); 335 } 336 337 public int getFetchDirection() throws RemoteException, SQLException { 338 return jdbcStatement_.getFetchDirection(); 339 } 340 341 public RJConnectionInterface getConnection() 342 throws RemoteException, SQLException { 343 return new RJConnectionServer(jdbcStatement_.getConnection()); 344 } 345 346 public int[] executeBatch() throws RemoteException, SQLException { 347 return jdbcStatement_.executeBatch(); 348 } 349 350 public void clearBatch() throws RemoteException, SQLException { 351 jdbcStatement_.clearBatch(); 352 } 353 354 public void addBatch(String sql) throws RemoteException, SQLException { 355 jdbcStatement_.addBatch(sql); 356 } 357 358 public boolean getMoreResults(int current) 360 throws RemoteException, SQLException { 361 return jdbcStatement_.getMoreResults(current); 362 } 363 364 public RJResultSetInterface getGeneratedKeys() 365 throws RemoteException, SQLException { 366 return new RJResultSetServer(jdbcStatement_.getGeneratedKeys()); 367 } 368 369 public int executeUpdate(String sql, int autoGeneratedKeys) 370 throws RemoteException, SQLException { 371 return jdbcStatement_.executeUpdate(sql, autoGeneratedKeys); 372 } 373 374 public int executeUpdate(String sql, int columnIndexes[]) 375 throws RemoteException, SQLException { 376 return jdbcStatement_.executeUpdate(sql, columnIndexes); 377 } 378 379 public int executeUpdate(String sql, String columnNames[]) 380 throws RemoteException, SQLException { 381 return jdbcStatement_.executeUpdate(sql, columnNames); 382 } 383 384 public boolean execute(String sql, int autoGeneratedKeys) 385 throws RemoteException, SQLException { 386 return jdbcStatement_.execute(sql, autoGeneratedKeys); 387 } 388 389 public boolean execute(String sql, int columnIndexes[]) 390 throws RemoteException, SQLException { 391 return jdbcStatement_.execute(sql, columnIndexes); 392 } 393 394 public boolean execute(String sql, String columnNames[]) 395 throws RemoteException, SQLException { 396 return jdbcStatement_.execute(sql, columnNames); 397 } 398 399 public int getResultSetHoldability() throws RemoteException, SQLException { 400 return jdbcStatement_.getResultSetHoldability(); 401 } 402 403 }; 404 405 | Popular Tags |