|
15 | 15 | import java.sql.ResultSet; |
16 | 16 | import java.sql.ResultSetMetaData; |
17 | 17 | import java.sql.SQLException; |
| 18 | +import java.sql.SQLFeatureNotSupportedException; |
18 | 19 | import java.sql.Statement; |
19 | 20 | import java.sql.Time; |
20 | 21 | import java.sql.Timestamp; |
@@ -185,10 +186,7 @@ public void setBigDecimal(int pos, BigDecimal value) throws SQLException { |
185 | 186 | */ |
186 | 187 | private byte[] readBytes(InputStream istream, int length) throws SQLException { |
187 | 188 | if (length < 0) { |
188 | | - SQLException exception = |
189 | | - new SQLException("Error reading stream. Length should be non-negative"); |
190 | | - |
191 | | - throw exception; |
| 189 | + throw new SQLException("Error reading stream. Length should be non-negative"); |
192 | 190 | } |
193 | 191 |
|
194 | 192 | byte[] bytes = new byte[length]; |
@@ -404,55 +402,97 @@ public ResultSetMetaData getMetaData() throws SQLException { |
404 | 402 | return (ResultSetMetaData) rs; |
405 | 403 | } |
406 | 404 |
|
407 | | - // UNUSED /////////////////////////////////////////////////////// |
408 | | - protected SQLException unused() { |
409 | | - return new SQLException("not implemented by SQLite JDBC driver"); |
| 405 | + protected SQLException unsupported() { |
| 406 | + return new SQLFeatureNotSupportedException("not implemented by SQLite JDBC driver"); |
| 407 | + } |
| 408 | + |
| 409 | + protected SQLException invalid() { |
| 410 | + return new SQLException("method cannot be called on a PreparedStatement"); |
410 | 411 | } |
411 | 412 |
|
412 | 413 | // PreparedStatement //////////////////////////////////////////// |
413 | 414 |
|
414 | 415 | public void setArray(int i, Array x) throws SQLException { |
415 | | - throw unused(); |
| 416 | + throw unsupported(); |
416 | 417 | } |
417 | | - // public void setBigDecimal(int parameterIndex, BigDecimal x) |
418 | | - // throws SQLException { throw unused(); } |
| 418 | + |
419 | 419 | public void setBlob(int i, Blob x) throws SQLException { |
420 | | - throw unused(); |
| 420 | + throw unsupported(); |
421 | 421 | } |
422 | 422 |
|
423 | 423 | public void setClob(int i, Clob x) throws SQLException { |
424 | | - throw unused(); |
| 424 | + throw unsupported(); |
425 | 425 | } |
426 | 426 |
|
427 | 427 | public void setRef(int i, Ref x) throws SQLException { |
428 | | - throw unused(); |
| 428 | + throw unsupported(); |
429 | 429 | } |
430 | 430 |
|
431 | 431 | public void setURL(int pos, URL x) throws SQLException { |
432 | | - throw unused(); |
| 432 | + throw unsupported(); |
433 | 433 | } |
434 | 434 |
|
435 | 435 | /** @see org.sqlite.core.CoreStatement#exec(java.lang.String) */ |
436 | 436 | @Override |
437 | 437 | public boolean execute(String sql) throws SQLException { |
438 | | - throw unused(); |
| 438 | + throw invalid(); |
| 439 | + } |
| 440 | + |
| 441 | + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { |
| 442 | + throw invalid(); |
| 443 | + } |
| 444 | + |
| 445 | + public boolean execute(String sql, int[] colinds) throws SQLException { |
| 446 | + throw invalid(); |
| 447 | + } |
| 448 | + |
| 449 | + public boolean execute(String sql, String[] colnames) throws SQLException { |
| 450 | + throw invalid(); |
439 | 451 | } |
440 | 452 |
|
441 | 453 | /** @see org.sqlite.core.CoreStatement#exec(java.lang.String) */ |
442 | 454 | @Override |
443 | 455 | public int executeUpdate(String sql) throws SQLException { |
444 | | - throw unused(); |
| 456 | + throw invalid(); |
| 457 | + } |
| 458 | + |
| 459 | + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { |
| 460 | + throw invalid(); |
| 461 | + } |
| 462 | + |
| 463 | + public int executeUpdate(String sql, int[] colinds) throws SQLException { |
| 464 | + throw invalid(); |
| 465 | + } |
| 466 | + |
| 467 | + public int executeUpdate(String sql, String[] cols) throws SQLException { |
| 468 | + throw invalid(); |
| 469 | + } |
| 470 | + |
| 471 | + public long executeLargeUpdate(String sql) throws SQLException { |
| 472 | + throw invalid(); |
| 473 | + } |
| 474 | + |
| 475 | + public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException { |
| 476 | + throw invalid(); |
| 477 | + } |
| 478 | + |
| 479 | + public long executeLargeUpdate(String sql, int[] colinds) throws SQLException { |
| 480 | + throw invalid(); |
| 481 | + } |
| 482 | + |
| 483 | + public long executeLargeUpdate(String sql, String[] cols) throws SQLException { |
| 484 | + throw invalid(); |
445 | 485 | } |
446 | 486 |
|
447 | 487 | /** @see org.sqlite.core.CoreStatement#exec(String) */ |
448 | 488 | @Override |
449 | 489 | public ResultSet executeQuery(String sql) throws SQLException { |
450 | | - throw unused(); |
| 490 | + throw invalid(); |
451 | 491 | } |
452 | 492 |
|
453 | 493 | /** */ |
454 | 494 | @Override |
455 | 495 | public void addBatch(String sql) throws SQLException { |
456 | | - throw unused(); |
| 496 | + throw invalid(); |
457 | 497 | } |
458 | 498 | } |
0 commit comments