1 19 20 21 package org.webdocwf.util.i18njdbc; 22 23 import java.io.File ; 24 import java.io.FileInputStream ; 25 import java.io.InputStream ; 26 import java.io.Reader ; 27 import java.math.BigDecimal ; 28 import java.net.URL ; 29 import java.sql.Array ; 30 import java.sql.Blob ; 31 import java.sql.Clob ; 32 import java.sql.Connection ; 33 import java.sql.Date ; 34 import java.sql.DriverManager ; 35 import java.sql.ParameterMetaData ; 36 import java.sql.PreparedStatement ; 37 import java.sql.Ref ; 38 import java.sql.ResultSet ; 39 import java.sql.ResultSetMetaData ; 40 import java.sql.SQLException ; 41 import java.sql.SQLWarning ; 42 import java.sql.Time ; 43 import java.sql.Timestamp ; 44 import java.util.ArrayList ; 45 import java.util.Calendar ; 46 import java.util.Enumeration ; 47 import java.util.Vector ; 48 49 55 public class I18nPreparedStatement implements PreparedStatement { 56 57 private I18nConnection connection; 58 private Vector resultSets = new Vector (); 59 private String sqlForPrepare = ""; 60 private String sqlPrepared = ""; 61 private int paramCount = 0; 62 private ArrayList parameters = new ArrayList (); 63 private ArrayList binaryStreamParameters = new ArrayList (); 64 65 public static String PREPARE_SEPARATOR = "~@#NEXTPARAMETER#@~"; 66 private String sql; 67 68 public I18nPreparedStatement(I18nConnection connection, String preparedSql) { 69 DriverManager.println("I18nJdbc - I18nStatement() - connection=" + connection); 70 this.sqlForPrepare = preparedSql; 71 this.sqlPrepared = preparedSql; 72 this.paramCount = countParameters(preparedSql); 73 for ( int i = 0; i < paramCount; i++ ) 74 parameters.add(null); 75 this.connection = connection; 76 } 77 78 private int countParameters(String sql) { 79 int count = 0; 80 int index = sql.indexOf(PREPARE_SEPARATOR); 81 while( index != -1 ) { 82 count++; 83 sql = sql.substring(index+1); 84 index = sql.indexOf(PREPARE_SEPARATOR); 85 } 86 return count; 87 } 88 89 private boolean prepareSql() throws SQLException { 90 boolean retVal = true; 91 for (int i = 0; i < parameters.size(); i++) { 92 int index = sqlPrepared.indexOf(PREPARE_SEPARATOR); 93 String val; 94 if (index != -1) { 95 if( parameters.get(i) == null ) 96 val = "null"; 97 else 98 val = parameters.get(i).toString(); 99 sqlPrepared = sqlPrepared.substring(0, index) + 100 val + 101 sqlPrepared.substring(index + PREPARE_SEPARATOR.length()); 102 } 103 } 104 if (sqlPrepared.indexOf(PREPARE_SEPARATOR) != -1) 105 throw new SQLException ( 106 "All ? in prepared query has to be replaced with values."); 107 else if (parameters.size() < this.paramCount) 108 throw new SQLException ( 109 "Number of setted parameters is less than number of parameters in statement."); 110 else if (parameters.size() > this.paramCount) 111 throw new SQLException ( 112 "Number of setted parameters is greater than number of parameters in statement."); 113 return retVal; 114 } 115 116 123 public void setMaxFieldSize(int p0) throws SQLException 124 { 125 throw new SQLException ("Not Supported !"); 126 } 127 128 129 136 public void setMaxRows(int p0) throws SQLException 137 { 138 throw new SQLException ("Not Supported !"); 139 } 140 141 142 149 public void setEscapeProcessing(boolean p0) throws SQLException 150 { 151 throw new SQLException ("Not Supported !"); 152 } 153 154 155 162 public void setQueryTimeout(int p0) throws SQLException 163 { 164 throw new SQLException ("Not Supported !"); 165 } 166 167 168 175 public void setCursorName(String p0) throws SQLException 176 { 177 throw new SQLException ("Not Supported !"); 178 } 179 180 181 188 public void setFetchDirection(int p0) throws SQLException 189 { 190 throw new SQLException ("Not Supported !"); 191 } 192 193 194 201 public void setFetchSize(int p0) throws SQLException 202 { 203 throw new SQLException ("Not Supported !"); 204 } 205 206 207 214 public int getMaxFieldSize() throws SQLException 215 { 216 throw new SQLException ("Not Supported !"); 217 } 218 219 220 227 public int getMaxRows() throws SQLException 228 { 229 throw new SQLException ("Not Supported !"); 230 } 231 232 233 240 public int getQueryTimeout() throws SQLException 241 { 242 throw new SQLException ("Not Supported !"); 243 } 244 245 246 253 public SQLWarning getWarnings() throws SQLException 254 { 255 throw new SQLException ("Not Supported !"); 256 } 257 258 259 266 public ResultSet getResultSet() throws SQLException 267 { 268 throw new SQLException ("Not Supported !"); 269 } 270 271 272 279 public int getUpdateCount() throws SQLException 280 { 281 throw new SQLException ("Not Supported !"); 282 } 283 284 285 292 public boolean getMoreResults() throws SQLException 293 { 294 throw new SQLException ("Not Supported !"); 295 } 296 297 298 305 public int getFetchDirection() throws SQLException 306 { 307 throw new SQLException ("Not Supported !"); 308 } 309 310 311 318 public int getFetchSize() throws SQLException 319 { 320 throw new SQLException ("Not Supported !"); 321 } 322 323 324 331 public int getResultSetConcurrency() throws SQLException 332 { 333 throw new SQLException ("Not Supported !"); 334 } 335 336 337 344 public int getResultSetType() throws SQLException 345 { 346 throw new SQLException ("Not Supported !"); 347 } 348 349 350 357 public Connection getConnection() throws SQLException 358 { 359 return connection; 360 } 361 362 363 371 public ResultSet executeQuery(String sql) throws SQLException 372 { 373 DriverManager.println("I18nJdbc - I18nStatement:executeQuery() - sql= " + sql); 374 I18nSqlParser parser = new I18nSqlParser(); 375 this.sql = sql; 376 try 377 { 378 parser.parse(this); 379 } 380 catch (Exception e) 381 { 382 throw new SQLException ("Syntax Error. " + e.getMessage()); 383 } 384 385 String fileName = connection.getPath() + parser.getTableName() + connection.getExtension(); 386 File checkFile = new File (fileName); 387 if (!checkFile.exists()) 388 { 389 throw new SQLException ("Cannot open data file '" + fileName + "' !"); 390 } 391 392 if (!checkFile.canRead()) 393 { 394 throw new SQLException ("Data file '" + fileName + "' not readable !"); 395 } 396 397 try 398 { 399 400 String [] xxx = parser.getColumnNames(); 401 String [] yyy = connection.getColumnNames(); 402 boolean isOK = true; 403 for(int i=0; i< xxx.length; i++) { 404 if(!xxx[i].endsWith("*")) { 405 out: 406 for(int j=0; j< yyy.length; j++) { 407 if(xxx[i].equalsIgnoreCase(yyy[j])) { 408 isOK=true; 409 break out; 410 } 411 else 412 isOK=false; 413 } 414 if(!isOK) 415 throw new SQLException ("Column '" + xxx[i] + "' not found."); 416 } 417 } 418 } 419 catch (Exception e) 420 { 421 if( I18nDriver.DEBUG ) 422 e.printStackTrace(); 423 throw new SQLException ("Error reading data file. Message was: " + e); 424 } 425 426 this.connection.setCurrentTableName(parser.getTableName()); 427 428 try { 430 if(connection.getAutoCommit()) { 431 connection.getProperties().load(new FileInputStream (checkFile)); 432 } 433 } catch (Exception e) { 434 throw new SQLException ("Error while loading properties"); 435 } 436 437 I18nResultSet resultSet = new I18nResultSet(this, 438 parser.getTableName(), parser.getColumnNames(), parser.getWhereColumnNames(), 439 parser.getWhereColumnValues()); 440 resultSets.add(resultSet); 441 return resultSet; 442 } 443 444 445 446 454 public int executeUpdate(String sql) throws SQLException 455 { 456 int updated=0; 457 DriverManager.println("I18nJdbc - I18nStatement:executeUpdate() - sql= " + sql); 458 I18nSqlParser parser = new I18nSqlParser(); 459 this.sql = sql; 460 try 461 { 462 parser.parse(this); 463 } 464 catch (Exception e) 465 { 466 throw new SQLException ("Syntax Error. " + e.getMessage()); 467 } 468 if(parser.sqlType.equals(I18nSqlParser.SELECT)) 469 throw new SQLException ("Not supported SELECT statement - use executeQuery method"); 470 else if (parser.sqlType.equals(I18nSqlParser.CREATE_TABLE)) { 471 throw new SQLException ("Not supported CREATE TABLE statement - use execute method"); 472 } 473 else if (parser.sqlType.equals(I18nSqlParser.INSERT)) { 474 String fileName = connection.getPath() + parser.getTableName() + connection.getExtension(); 475 File checkFile = new File (fileName); 476 477 if (!checkFile.exists()) 478 { 479 throw new SQLException ("Cannot open data file '" + fileName + "' !"); 480 } 481 482 if (!checkFile.canWrite()) 483 { 484 throw new SQLException ("Data file '" + fileName + "' is read only !"); 485 } 486 try 487 { 488 String [] xxx = parser.getColumnNames(); 489 String [] yyy = connection.getColumnNames(); 490 boolean isOK = true; 491 for(int i=0; i< xxx.length; i++) { 492 if(!xxx[i].endsWith("*")) { 493 out: 494 for(int j=0; j< yyy.length; j++) { 495 if(xxx[i].equalsIgnoreCase(yyy[j])) { 496 isOK=true; 497 break out; 498 } 499 else 500 isOK=false; 501 } 502 if(!isOK) 503 throw new SQLException ("Column '" + xxx[i] + "' not found."); 504 } 505 } 506 try { 507 String [] colValues = parser.columnValues; 508 String [] colNames = parser.columnNames; 509 String keyColumn=connection.getNameColumn(); 510 String key; 511 String value; 512 if (colNames.length!=colValues.length){ 513 throw new Exception ("Number of columns and number of values are different!"); 514 } 515 if (colNames[0].equalsIgnoreCase(keyColumn)){ 516 key = colValues[0]; 517 value = colValues[1]; 518 }else{ 519 key = colValues[1]; 520 value = colValues[0]; 521 } 522 523 connection.setCurrentTableName(parser.getTableName()); 524 525 if(connection.getAutoCommit()) { 526 connection.getProperties().load(new FileInputStream (checkFile)); 527 } 528 if (connection.getProperties().containsKey(key)==true){ 529 throw new Exception ("Key already exist in the property file. Key must be unique!"); 530 }else{ 531 connection.getProperties().put(key,value); 532 if(connection.getAutoCommit()) { 533 connection.getProperties().store(checkFile); 534 } 535 updated++; 536 } 537 538 } catch (Exception e) { 539 throw new SQLException ("Error writing data to property file."+e.getMessage()); 540 } 541 } 542 catch (Exception e) 543 { 544 throw new SQLException ("Error writing data file. Message was: " + e); 545 } 546 547 } 548 else if (parser.sqlType.equals(I18nSqlParser.UPDATE)) { 549 550 String fileName = connection.getPath() + parser.getTableName() + connection.getExtension(); 551 File checkFile = new File (fileName); 552 553 if (!checkFile.exists()) 554 { 555 throw new SQLException ("Cannot open data file '" + fileName + "' !"); 556 } 557 558 if (!checkFile.canWrite()) 559 { 560 throw new SQLException ("Data file '" + fileName + "' is read only !"); 561 } 562 563 try 564 { 565 String [] xxx = parser.getColumnNames(); 566 String [] yyy = connection.getColumnNames(); 567 boolean isOK = true; 568 for(int i=0; i< xxx.length; i++) { 569 if(!xxx[i].endsWith("*")) { 570 out: 571 for(int j=0; j< yyy.length; j++) { 572 if(xxx[i].equalsIgnoreCase(yyy[j])) { 573 isOK=true; 574 break out; 575 } 576 else 577 isOK=false; 578 } 579 if(!isOK) 580 throw new SQLException ("Column '" + xxx[i] + "' not found."); 581 } 582 } 583 584 try { 585 String [] colValues = parser.columnValues; 586 String [] colNames = parser.columnNames; 587 String [] colWhereNames = parser.columnWhereNames; 588 String [] colWhereValues = parser.columnWhereValues; 589 String keyColumn=connection.getNameColumn(); 590 String valueColumn=connection.getValueColumn(); 591 String key = ""; 592 String value = ""; 593 boolean paramsOK = true; 594 if (colNames[0].equalsIgnoreCase(keyColumn)){ 597 if (colValues.length==1){ 598 key = colValues[0]; 599 }else if (colValues.length==2){ 600 key = colValues[0]; 601 value = colValues[1]; 602 } 603 }else if (colNames[0].equalsIgnoreCase(valueColumn)){ 606 if (colValues.length==1){ 607 value = colValues[0]; 608 }else if (colValues.length==2){ 609 value = colValues[0]; 610 key = colValues[1]; 611 } 612 } 613 614 connection.setCurrentTableName(parser.getTableName()); 615 616 if(connection.getAutoCommit()) { 617 connection.getProperties().load(new FileInputStream (checkFile)); 618 } 619 if (!(colWhereNames[0].equalsIgnoreCase(keyColumn) || colWhereNames[0].equalsIgnoreCase(valueColumn))){ 620 throw new SQLException ("Error in sql statement. Wrong column name!"); 621 } 622 if ((!key.equalsIgnoreCase("")) && (!value.equalsIgnoreCase(""))){ 623 Enumeration en = connection.getProperties().keys(); 624 while(en.hasMoreElements()){ 625 String oldKey = en.nextElement().toString(); 626 String oldValue = connection.getProperties().getProperty(oldKey); 627 if ((colWhereValues[0].equalsIgnoreCase(oldKey) && keyColumn.equals(colWhereNames[0])) 630 ||(colWhereValues[0].equalsIgnoreCase(oldValue) && valueColumn.equals(colWhereNames[0]))){ 631 connection.getProperties().remove(oldKey); 632 connection.getProperties().put(key, value); 633 updated++; 634 } 635 } 636 637 }else if (!value.equalsIgnoreCase("")){ 638 639 Enumeration en = connection.getProperties().keys(); 640 while(en.hasMoreElements()){ 641 String oldKey = en.nextElement().toString(); 642 String oldValue = connection.getProperties().getProperty(oldKey); 643 if ((colWhereValues[0].equalsIgnoreCase(oldKey) && keyColumn.equals(colWhereNames[0])) 646 ||(colWhereValues[0].equalsIgnoreCase(oldValue) && valueColumn.equals(colWhereNames[0]))){ 647 connection.getProperties().put(oldKey,value); 648 updated++; 649 } 650 } 651 }else if (!key.equalsIgnoreCase("")){ 652 653 Enumeration en = connection.getProperties().keys(); 654 while(en.hasMoreElements()){ 655 String oldKey = en.nextElement().toString(); 656 String oldValue = connection.getProperties().getProperty(oldKey); 657 if ((colWhereValues[0].equalsIgnoreCase(oldKey) && keyColumn.equals(colWhereNames[0])) 660 ||(colWhereValues[0].equalsIgnoreCase(oldValue) && valueColumn.equals(colWhereNames[0]))){ 661 connection.getProperties().remove(oldKey); 662 connection.getProperties().put(key, oldValue); 663 updated++; 664 } 665 } 666 667 } 668 if(connection.getAutoCommit()) { 669 connection.getProperties().store(checkFile); 670 } 671 } catch (Exception e) { 673 throw new SQLException ("Error writing data to property file."+e.getMessage()); 674 } 675 676 } 677 catch (Exception e) 678 { 679 throw new SQLException ("Error writing data file. Message was: " + e); 680 } 681 682 }else if (parser.sqlType.equals(I18nSqlParser.DELETE)){ 683 String fileName = connection.getPath() + parser.getTableName() + connection.getExtension(); 684 File checkFile = new File (fileName); 685 686 if (!checkFile.exists()) 687 { 688 throw new SQLException ("Cannot open data file '" + fileName + "' !"); 689 } 690 691 if (!checkFile.canWrite()) 692 { 693 throw new SQLException ("Data file '" + fileName + "' is read only !"); 694 } 695 try 696 { 697 698 boolean deleteAll=false; 700 String [] colWhereNames = parser.columnWhereNames; 701 String [] colWhereValues = parser.columnWhereValues; 702 String keyColumn=connection.getNameColumn(); 703 String valueColumn=connection.getValueColumn(); 704 705 connection.setCurrentTableName(parser.getTableName()); 706 707 if(connection.getAutoCommit()) { 708 connection.getProperties().load(new FileInputStream (checkFile)); 709 } 710 if (!(colWhereNames[0].equalsIgnoreCase(keyColumn) || colWhereNames[0].equalsIgnoreCase(valueColumn))){ 711 throw new SQLException ("Error in sql statement. Wrong column name!"); 712 } 713 Enumeration en = connection.getProperties().keys(); 714 if (colWhereNames.length==0){ 715 deleteAll=true; 716 } 717 if (!deleteAll){ 718 while(en.hasMoreElements()){ 719 String oldKey = en.nextElement().toString(); 720 String oldValue = connection.getProperties().getProperty(oldKey); 721 722 if ((colWhereValues[0].equalsIgnoreCase(oldKey) && keyColumn.equals(colWhereNames[0])) 723 ||(colWhereValues[0].equalsIgnoreCase(oldValue) && valueColumn.equals(colWhereNames[0]))){ 724 connection.getProperties().remove(oldKey); 725 if(connection.getAutoCommit()) { 726 connection.getProperties().store(checkFile); 727 } 728 updated++; 729 } 730 731 } 732 }else{ 733 connection.getProperties().clear(); 734 if(connection.getAutoCommit()) { 735 connection.getProperties().store(checkFile); 736 } 737 } 738 } catch (Exception e) { 739 throw new SQLException ("Error deleting data from property file."+e.getMessage()); 740 } 741 742 } 743 return updated; 744 745 } 746 747 748 766 public void close() throws SQLException { 767 for(Enumeration i = resultSets.elements(); i.hasMoreElements(); ) { 769 I18nResultSet resultSet = (I18nResultSet) i.nextElement(); 770 resultSet.close(); 771 } 772 773 } 774 775 781 public void cancel() throws SQLException 782 { 783 throw new SQLException ("Not Supported !"); 784 } 785 786 787 793 public void clearWarnings() throws SQLException 794 { 795 throw new SQLException ("Not Supported !"); 796 } 797 798 799 807 public boolean execute(String sql) throws SQLException 808 { 809 I18nSqlParser parser = new I18nSqlParser(); 810 if( binaryStreamParameters.size() != 0 ) 811 parser.setBinaryStreamList( binaryStreamParameters ); 812 this.sql = sql; 813 try 814 { 815 parser.parse(this); 816 } 817 catch (Exception e) 818 { 819 throw new SQLException ("Syntax Error. " + e.getMessage()); 820 } 821 if(parser.sqlType.equals(I18nSqlParser.SELECT)) 822 throw new SQLException ("Not supported SELECT statement - use executeQuery method"); 823 else if (parser.sqlType.equals(I18nSqlParser.INSERT)) 824 executeUpdate(sql); 825 else if (parser.sqlType.equals(I18nSqlParser.CREATE_TABLE)) { 826 String fileName = connection.getPath() + parser.getTableName() + connection.getExtension(); 827 File checkFile = new File (fileName); 828 829 if (checkFile.exists()) 830 { 831 throw new SQLException ("Data file '" + fileName + "'already exists !"); 832 } 833 834 try 835 { 836 checkFile.createNewFile(); 837 838 } 839 catch (Exception e) 840 { 841 throw new SQLException ("Error reading data file. Message was: " + e); 842 } 843 } 844 return true; 845 846 } 847 848 854 public void setString(int parameterIndex, String value) throws SQLException { 855 if( value == null ) { 856 I18nDriver.log("value = null object"); 857 parameters.set(parameterIndex - 1, value); 858 } else { 859 value = Utils.replaceAll(value, "'", I18nSqlParser.QUOTE_ESCAPE); 860 I18nDriver.log("value = " + value); 861 parameters.set(parameterIndex - 1, "'" + value + "'"); 862 } 863 } 864 865 866 872 public void setBytes(int parameterIndex, byte[] value) throws SQLException { 873 binaryStreamParameters.add(Utils.bytesToHexString(value)); 874 String paramName = I18nSqlParser.BINARY_STREAM_OBJECT+""+binaryStreamParameters.size(); 875 parameters.set(parameterIndex-1, paramName); 876 } 877 878 885 public void addBatch(String p0) throws SQLException 886 { 887 throw new SQLException ("Not Supported !"); 888 } 889 890 891 897 public void clearBatch() throws SQLException 898 { 899 throw new SQLException ("Not Supported !"); 900 } 901 902 903 910 public int[] executeBatch() throws SQLException 911 { 912 throw new SQLException ("Not Supported !"); 913 } 914 915 919 public boolean getMoreResults(int current) throws SQLException { 920 throw new UnsupportedOperationException ("Statement.getMoreResults(int) unsupported"); 921 } 922 923 public ResultSet getGeneratedKeys() throws SQLException { 924 throw new UnsupportedOperationException ("Statement.getGeneratedKeys() unsupported"); 925 } 926 927 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { 928 throw new UnsupportedOperationException ("Statement.executeUpdate(String,int) unsupported"); 929 } 930 931 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { 932 throw new UnsupportedOperationException ("Statement.executeUpdate(String,int[]) unsupported"); 933 } 934 935 public int executeUpdate(String sql, String [] columnNames) throws SQLException { 936 throw new UnsupportedOperationException ("Statement.executeUpdate(String,String[]) unsupported"); 937 } 938 939 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { 940 throw new UnsupportedOperationException ("Statement.execute(String,int) unsupported"); 941 } 942 943 public boolean execute(String sql, int[] columnIndexes) throws SQLException { 944 throw new UnsupportedOperationException ("Statement.execute(String,int[]) unsupported"); 945 } 946 947 public boolean execute(String sql, String [] columnNames) throws SQLException { 948 throw new UnsupportedOperationException ("Statement.execute(String,String[]) unsupported"); 949 } 950 951 public int getResultSetHoldability() throws SQLException { 952 throw new UnsupportedOperationException ("Statement.getResultSetHoldability() unsupported"); 953 } 954 955 956 957 public ResultSet executeQuery() throws SQLException { 958 if( !prepareSql()) 959 throw new SQLException ("Error with prepared statement !"); 960 return executeQuery(this.sqlPrepared); 961 962 } 963 public int executeUpdate() throws SQLException { 964 if( !prepareSql()) 965 throw new SQLException ("Error with prepared statement !"); 966 executeUpdate(this.sqlPrepared); 967 return 0; 968 } 969 970 971 972 973 974 public void setNull(int parameterIndex, int sqlType) throws SQLException { 975 this.setString(parameterIndex, null ); 976 } 977 978 public void setBoolean(int parameterIndex, boolean value) throws SQLException { 979 this.setString(parameterIndex, String.valueOf(value) ); 980 } 981 982 public void setByte(int parameterIndex, byte value) throws SQLException { 983 this.setString(parameterIndex, String.valueOf(value) ); 984 } 985 986 public void setShort(int parameterIndex, short value) throws SQLException { 987 this.setString(parameterIndex, String.valueOf(value) ); 988 } 989 990 public void setInt(int parameterIndex, int value) throws SQLException { 991 this.setString(parameterIndex, String.valueOf(value) ); 992 } 993 994 public void setLong(int parameterIndex, long value) throws SQLException { 995 this.setString(parameterIndex, String.valueOf(value) ); 996 } 997 998 public void setFloat(int parameterIndex, float value) throws SQLException { 999 this.setString(parameterIndex, String.valueOf(value) ); 1000 } 1001 1002 public void setDouble(int parameterIndex, double value) throws SQLException { 1003 this.setString(parameterIndex, String.valueOf(value) ); 1004 } 1005 1006 public void setBigDecimal(int parameterIndex, BigDecimal value) throws SQLException { 1007 if(value == null) { 1008 this.setString( parameterIndex, value.toString() ); 1009 } else { 1010 this.setString( parameterIndex, "" ); 1011 } 1012 } 1013 1014 public void setDate(int parameterIndex, Date value) throws SQLException { 1015 if(value == null) { 1016 this.setString( parameterIndex, value.toString() ); 1017 } else { 1018 this.setString( parameterIndex, "" ); 1019 } 1020 } 1021 1022 public void setTime(int parameterIndex, Time value) throws SQLException { 1023 if(value == null) { 1024 this.setString( parameterIndex, value.toString() ); 1025 } else { 1026 this.setString( parameterIndex, "" ); 1027 } 1028 } 1029 1030 public void setTimestamp(int parameterIndex, Timestamp value) throws SQLException { 1031 if(value == null) { 1032 this.setString( parameterIndex, value.toString() ); 1033 } else { 1034 this.setString( parameterIndex, "" ); 1035 } 1036 } 1037 1038 public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { 1039 1040 throw new java.lang.UnsupportedOperationException ("Method setAsciiStream() not yet implemented."); 1041 } 1042 public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { 1043 1044 throw new java.lang.UnsupportedOperationException ("Method setUnicodeStream() not yet implemented."); 1045 } 1046 1047 public void clearParameters() throws SQLException { 1048 this.sqlPrepared = this.sqlForPrepare; 1049 for(int i = 0; i < parameters.size(); i++) 1050 parameters.set(i, null); 1051 } 1052 public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { 1053 1054 throw new java.lang.UnsupportedOperationException ("Method setObject() not yet implemented."); 1055 } 1056 public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { 1057 1058 throw new java.lang.UnsupportedOperationException ("Method setObject() not yet implemented."); 1059 } 1060 public void setObject(int parameterIndex, Object x) throws SQLException { 1061 if( x == null ) 1062 x = new String ("null"); 1063 setString( parameterIndex, x.toString() ); 1064 } 1065 public boolean execute() throws SQLException { 1066 1067 throw new java.lang.UnsupportedOperationException ("Method execute() not yet implemented."); 1068 } 1069 public void addBatch() throws SQLException { 1070 1071 throw new java.lang.UnsupportedOperationException ("Method addBatch() not yet implemented."); 1072 } 1073 public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { 1074 1075 throw new java.lang.UnsupportedOperationException ("Method setCharacterStream() not yet implemented."); 1076 } 1077 public void setRef(int i, Ref x) throws SQLException { 1078 1079 throw new java.lang.UnsupportedOperationException ("Method setRef() not yet implemented."); 1080 } 1081 1082 public void setClob(int i, Clob x) throws SQLException { 1083 1084 throw new java.lang.UnsupportedOperationException ("Method setClob() not yet implemented."); 1085 } 1086 public void setArray(int i, Array x) throws SQLException { 1087 1088 throw new java.lang.UnsupportedOperationException ("Method setArray() not yet implemented."); 1089 } 1090 public ResultSetMetaData getMetaData() throws SQLException { 1091 1092 throw new java.lang.UnsupportedOperationException ("Method getMetaData() not yet implemented."); 1093 } 1094 public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { 1095 1096 throw new java.lang.UnsupportedOperationException ("Method setDate() not yet implemented."); 1097 } 1098 public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { 1099 1100 throw new java.lang.UnsupportedOperationException ("Method setTime() not yet implemented."); 1101 } 1102 public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { 1103 1104 throw new java.lang.UnsupportedOperationException ("Method setTimestamp() not yet implemented."); 1105 } 1106 public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { 1107 this.setString(paramIndex, null ); 1108 } 1109 1110 public void setURL(int parameterIndex, URL x) throws SQLException { 1111 1112 throw new java.lang.UnsupportedOperationException ( 1113 "Method setURL() not yet implemented."); 1114 } 1115 1116 public ParameterMetaData getParameterMetaData() throws SQLException { 1117 1118 throw new java.lang.UnsupportedOperationException ( 1119 "Method getParameterMetaData() not yet implemented."); 1120 } 1121 1122 public void setBinaryStream(int parameterIndex, InputStream value, int length) throws 1123 SQLException { 1124 1125 throw new java.lang.UnsupportedOperationException ( 1126 "Method setBinaryStream() not yet implemented."); 1127 } 1128 1129 public void setBlob(int parameterIndex, Blob value) throws SQLException { 1130 1131 throw new java.lang.UnsupportedOperationException ( 1132 "Method setBlob() not yet implemented."); 1133 } 1134 1135 public String getSqlStatement() { 1136 return sql; 1137 } 1138 1139 public I18nProperties getProperties() { 1140 return connection.getProperties(); 1141 } 1142 1143} | Popular Tags |