1 23 24 29 30 package com.sun.jdo.spi.persistence.support.sqlstore.connection; 31 32 import java.math.BigDecimal ; 33 import java.sql.*; 34 35 36 42 47 public class PreparedStatementImpl 48 extends StatementImpl 49 implements PreparedStatement { 50 public PreparedStatementImpl() { 54 super(); 55 this.conn = null; 56 this.stmt = null; 57 } 58 59 public PreparedStatementImpl(ConnectionImpl conn, 67 PreparedStatement pstmt) { 68 super(); 69 this.conn = conn; 70 this.stmt = (Statement) pstmt; 71 } 72 73 76 public ResultSet executeQuery() throws SQLException { 77 PreparedStatement pstmt = (PreparedStatement) this.stmt; 78 79 try { 80 this.conn.checkXact(); 81 return (pstmt.executeQuery()); 82 } catch (SQLException se) { 83 throw se; 84 } 85 } 86 87 public int executeUpdate() throws SQLException { 88 PreparedStatement pstmt = (PreparedStatement) this.stmt; 89 90 try { 91 this.conn.checkXact(); 92 return (pstmt.executeUpdate()); 93 } catch (SQLException se) { 94 throw se; 95 } 96 } 97 98 public void setNull(int parameterIndex, int sqlType) throws SQLException { 99 PreparedStatement pstmt = (PreparedStatement) this.stmt; 100 101 try { 102 pstmt.setNull(parameterIndex, sqlType); 103 } catch (SQLException se) { 104 throw se; 105 } 106 } 107 108 public void setBoolean(int parameterIndex, boolean x) throws SQLException { 109 PreparedStatement pstmt = (PreparedStatement) this.stmt; 110 111 try { 112 pstmt.setBoolean(parameterIndex, x); 113 } catch (SQLException se) { 114 throw se; 115 } 116 } 117 118 public void setByte(int parameterIndex, byte x) throws SQLException { 119 PreparedStatement pstmt = (PreparedStatement) this.stmt; 120 121 try { 122 pstmt.setByte(parameterIndex, x); 123 } catch (SQLException se) { 124 throw se; 125 } 126 } 127 128 public void setShort(int parameterIndex, short x) throws SQLException { 129 PreparedStatement pstmt = (PreparedStatement) this.stmt; 130 131 try { 132 pstmt.setShort(parameterIndex, x); 133 } catch (SQLException se) { 134 throw se; 135 } 136 } 137 138 public void setInt(int parameterIndex, int x) throws SQLException { 139 PreparedStatement pstmt = (PreparedStatement) this.stmt; 140 141 try { 142 pstmt.setInt(parameterIndex, x); 143 } catch (SQLException se) { 144 throw se; 145 } 146 } 147 148 public void setLong(int parameterIndex, long x) throws SQLException { 149 PreparedStatement pstmt = (PreparedStatement) this.stmt; 150 151 try { 152 pstmt.setLong(parameterIndex, x); 153 } catch (SQLException se) { 154 throw se; 155 } 156 } 157 158 public void setFloat(int parameterIndex, float x) throws SQLException { 159 PreparedStatement pstmt = (PreparedStatement) this.stmt; 160 161 try { 162 pstmt.setFloat(parameterIndex, x); 163 } catch (SQLException se) { 164 throw se; 165 } 166 } 167 168 public void setDouble(int parameterIndex, double x) throws SQLException { 169 PreparedStatement pstmt = (PreparedStatement) this.stmt; 170 171 try { 172 pstmt.setDouble(parameterIndex, x); 173 } catch (SQLException se) { 174 throw se; 175 } 176 } 177 178 public void setBigDecimal(int parameterIndex, BigDecimal x) 179 throws SQLException { 180 PreparedStatement pstmt = (PreparedStatement) this.stmt; 181 182 try { 183 pstmt.setBigDecimal(parameterIndex, x); 184 } catch (SQLException se) { 185 throw se; 186 } 187 } 188 189 public void setString(int parameterIndex, String x) throws SQLException { 190 PreparedStatement pstmt = (PreparedStatement) this.stmt; 191 192 try { 193 pstmt.setString(parameterIndex, x); 194 } catch (SQLException se) { 195 throw se; 196 } 197 } 198 199 public void setBytes(int parameterIndex, byte x[]) throws SQLException { 200 PreparedStatement pstmt = (PreparedStatement) this.stmt; 201 202 try { 203 pstmt.setBytes(parameterIndex, x); 204 } catch (SQLException se) { 205 throw se; 206 } 207 } 208 209 public void setDate(int parameterIndex, java.sql.Date x) 210 throws SQLException { 211 PreparedStatement pstmt = (PreparedStatement) this.stmt; 212 213 try { 214 pstmt.setDate(parameterIndex, x); 215 } catch (SQLException se) { 216 throw se; 217 } 218 } 219 220 public void setTime(int parameterIndex, java.sql.Time x) 221 throws SQLException { 222 PreparedStatement pstmt = (PreparedStatement) this.stmt; 223 224 try { 225 pstmt.setTime(parameterIndex, x); 226 } catch (SQLException se) { 227 throw se; 228 } 229 } 230 231 public void setTimestamp(int parameterIndex, java.sql.Timestamp x) 232 throws SQLException { 233 PreparedStatement pstmt = (PreparedStatement) this.stmt; 234 235 try { 236 pstmt.setTimestamp(parameterIndex, x); 237 } catch (SQLException se) { 238 throw se; 239 } 240 } 241 242 public void setTimestamp(int parameterIndex, java.sql.Timestamp x, 243 java.util.Calendar cal) 244 throws SQLException { 245 PreparedStatement pstmt = (PreparedStatement) this.stmt; 246 247 try { 248 pstmt.setTimestamp(parameterIndex, x); 249 } catch (SQLException se) { 250 throw se; 251 } 252 } 253 254 public void setTime(int parameterIndex, java.sql.Time x, 255 java.util.Calendar cal) 256 throws SQLException { 257 PreparedStatement pstmt = (PreparedStatement) this.stmt; 258 259 try { 260 pstmt.setTime(parameterIndex, x); 261 } catch (SQLException se) { 262 throw se; 263 } 264 } 265 266 public void setArray(int i, Array x) 267 throws SQLException { 268 } 269 270 public void setClob(int i, Clob x) 271 throws SQLException { 272 } 273 274 public ResultSetMetaData getMetaData() 275 throws SQLException { 276 return (null); 277 } 278 279 public Clob getClob(int i) 280 throws SQLException { 281 return (null); 282 } 283 284 public void setDate(int parameterIndex, Date x, 285 java.util.Calendar cal) 286 throws SQLException { 287 } 288 289 public Array getArray(int i) 290 throws SQLException { 291 return (null); 292 } 293 294 public Time getTime(int parameterIndex, java.util.Calendar cal) 295 throws SQLException { 296 return (null); 297 } 298 299 public Blob getBlob(int i) 300 throws SQLException { 301 return (null); 302 } 303 304 public void setBlob(int i, Blob x) throws SQLException { 305 } 306 307 public Date getDate(int parameterIndex, java.util.Calendar cal) 308 throws SQLException { 309 return (null); 310 } 311 312 public Timestamp getTimestamp(int parameterIndex, 313 java.util.Calendar cal) 314 throws SQLException { 315 return (null); 316 } 317 318 public void setAsciiStream(int parameterIndex, 319 java.io.InputStream x, 320 int length) 321 throws SQLException { 322 PreparedStatement pstmt = (PreparedStatement) this.stmt; 323 324 try { 325 pstmt.setAsciiStream(parameterIndex, x, length); 326 } catch (SQLException se) { 327 throw se; 328 } 329 } 330 331 334 public void setUnicodeStream(int parameterIndex, 335 java.io.InputStream x, 336 int length) 337 throws SQLException { 338 PreparedStatement pstmt = (PreparedStatement) this.stmt; 339 340 try { 341 pstmt.setUnicodeStream(parameterIndex, x, length); 342 } catch (SQLException se) { 343 throw se; 344 } 345 } 346 347 public void setBinaryStream(int parameterIndex, 348 java.io.InputStream x, 349 int length) 350 throws SQLException { 351 PreparedStatement pstmt = (PreparedStatement) this.stmt; 352 353 try { 354 pstmt.setBinaryStream(parameterIndex, x, length); 355 } catch (SQLException se) { 356 throw se; 357 } 358 } 359 360 public void clearParameters() throws SQLException { 361 PreparedStatement pstmt = (PreparedStatement) this.stmt; 362 363 try { 364 pstmt.clearParameters(); 365 } catch (SQLException se) { 366 throw se; 367 } 368 } 369 370 373 public void setObject(int parameterIndex, 374 Object x, int targetSqlType, int scale) 375 throws SQLException { 376 PreparedStatement pstmt = (PreparedStatement) this.stmt; 377 378 try { 379 pstmt.setObject(parameterIndex, x, targetSqlType, scale); 380 } catch (SQLException se) { 381 throw se; 382 } 383 } 384 385 public void setObject(int parameterIndex, 386 Object x, int targetSqlType) 387 throws SQLException { 388 PreparedStatement pstmt = (PreparedStatement) this.stmt; 389 390 try { 391 pstmt.setObject(parameterIndex, x, targetSqlType); 392 } catch (SQLException se) { 393 throw se; 394 } 395 } 396 397 public void setObject(int parameterIndex, Object x) throws SQLException { 398 PreparedStatement pstmt = (PreparedStatement) this.stmt; 399 400 try { 401 pstmt.setObject(parameterIndex, x); 402 } catch (SQLException se) { 403 throw se; 404 } 405 } 406 407 public boolean execute() throws SQLException { 408 PreparedStatement pstmt = (PreparedStatement) this.stmt; 409 410 try { 411 this.conn.checkXact(); 412 return (pstmt.execute()); 413 } catch (SQLException se) { 414 throw se; 415 } 416 } 417 418 420 public void addBatch() throws SQLException { 421 PreparedStatement pstmt = (PreparedStatement) this.stmt; 422 423 try { 424 pstmt.addBatch(); 425 } catch (SQLException se) { 426 throw se; 427 } 428 } 429 430 public void setCharacterStream(int parameterIndex, 431 java.io.Reader reader, 432 int length) throws SQLException { 433 PreparedStatement pstmt = (PreparedStatement) this.stmt; 434 435 try { 436 pstmt.setCharacterStream(parameterIndex, reader, length); 437 } catch (SQLException se) { 438 throw se; 439 } 440 } 441 442 public void setRef(int i, Ref x) throws SQLException { 443 PreparedStatement pstmt = (PreparedStatement) this.stmt; 444 445 try { 446 pstmt.setRef(i, x); 447 } catch (SQLException se) { 448 throw se; 449 } 450 } 451 452 511 512 514 public void setNull(int i, int j, String str) throws SQLException { 515 PreparedStatement pstmt = (PreparedStatement) this.stmt; 516 517 527 } 528 529 public void setURL(int parameterIndex,java.net.URL x) throws SQLException { 531 throw new UnsupportedOperationException (); 532 } 533 534 public ParameterMetaData getParameterMetaData() throws SQLException { 535 536 throw new UnsupportedOperationException (); 537 } 538 539 } 541 | Popular Tags |