zoukankan      html  css  js  c++  java
  • 使用PreparedStatement时,输出完整的SQL语句

    使用psstmt时不能打印出完整的sql语句,挺不方便的,找到一个实现方法,记录下来。

    1. package com.zhh.function.util;  
    2.   
    3. import java.io.InputStream;    
    4. import java.io.Reader;    
    5. import java.math.BigDecimal;    
    6. import java.net.URL;    
    7. import java.sql.Array;    
    8. import java.sql.Blob;    
    9. import java.sql.Clob;    
    10. import java.sql.Connection;    
    11. import java.sql.Date;    
    12. import java.sql.NClob;  
    13. import java.sql.ParameterMetaData;    
    14. import java.sql.PreparedStatement;    
    15. import java.sql.Ref;    
    16. import java.sql.ResultSet;    
    17. import java.sql.ResultSetMetaData;    
    18. import java.sql.RowId;  
    19. import java.sql.SQLException;    
    20. import java.sql.SQLWarning;    
    21. import java.sql.SQLXML;  
    22. import java.sql.Time;    
    23. import java.sql.Timestamp;    
    24. import java.util.ArrayList;    
    25. import java.util.Calendar;    
    26.     
    27. /**  
    28.  *   
    29.  * 项目名称:CFR      
    30.  * 类名称:LoggableStatement      
    31.  * 类描述:扩展PreparedStatement,以便输出执行的sql语句,即sql日志    
    32.  * 创建时间:2010-6-22 下午10:47:39         
    33.  * @version   1.0  
    34.  * @author zhh  
    35. *来自网络 *  
    36.  */    
    37. public class LoggableStatement implements PreparedStatement {    
    38.     
    39.     /** used for storing parameter values needed for producing log */    
    40.     private ArrayList parameterValues;    
    41.     
    42.     /** the query string with question marks as parameter placeholders */    
    43.     private String sqlTemplate;    
    44.     
    45.     /** a statement created from a real database connection */    
    46.     private PreparedStatement wrappedStatement;    
    47.     
    48.     public LoggableStatement(Connection connection, String sql)    
    49.             throws SQLException {    
    50.         // use connection to make a prepared statement    
    51.         wrappedStatement = connection.prepareStatement(sql);    
    52.         sqlTemplate = sql;    
    53.         parameterValues = new ArrayList();    
    54.     }    
    55.     
    56.     private void saveQueryParamValue(int position, Object obj) {    
    57.         String strValue;    
    58.         if (obj instanceof String || obj instanceof Date) {    
    59.             // if we have a String, include '' in the saved value    
    60.             strValue = "'" + obj + "'";    
    61.         } else {    
    62.             if (obj == null) {    
    63.                 // convert null to the string null    
    64.                 strValue = "null";    
    65.             } else {    
    66.                 // unknown object (includes all Numbers), just call toString    
    67.                 strValue = obj.toString();    
    68.             }    
    69.         }    
    70.         // if we are setting a position larger than current size of    
    71.         // parameterValues, first make it larger    
    72.         while (position >= parameterValues.size()) {    
    73.     
    74.             parameterValues.add(null);    
    75.         }    
    76.         // save the parameter    
    77.         parameterValues.set(position, strValue);    
    78.     }    
    79.     
    80.     // 这一步是对ArrayList与sql进行处理,输出完整的sql语句    
    81.     public String getQueryString() {    
    82.         int len = sqlTemplate.length();    
    83.         StringBuffer t = new StringBuffer(len * 2);    
    84.     
    85.         if (parameterValues != null) {    
    86.             int i = 1, limit = 0, base = 0;    
    87.     
    88.             while ((limit = sqlTemplate.indexOf('?', limit)) != -1) {    
    89.                 t.append(sqlTemplate.substring(base, limit));    
    90.                 t.append(parameterValues.get(i));    
    91.                 i++;    
    92.                 limit++;    
    93.                 base = limit;    
    94.             }    
    95.             if (base < len) {    
    96.                 t.append(sqlTemplate.substring(base));    
    97.             }    
    98.         }    
    99.         return t.toString();    
    100.     }    
    101.     
    102.     public void addBatch() throws SQLException {    
    103.         wrappedStatement.addBatch();    
    104.     }    
    105.     
    106.     public void clearParameters() throws SQLException {    
    107.         wrappedStatement.clearParameters();    
    108.     }    
    109.     
    110.     public boolean execute() throws SQLException {    
    111.         return wrappedStatement.execute();    
    112.     }    
    113.     
    114.     public ResultSet executeQuery() throws SQLException {    
    115.         return wrappedStatement.executeQuery();    
    116.     }    
    117.     
    118.     public int executeUpdate() throws SQLException {    
    119.         return wrappedStatement.executeUpdate();    
    120.     }    
    121.     
    122.     public ResultSetMetaData getMetaData() throws SQLException {    
    123.         return wrappedStatement.getMetaData();    
    124.     }    
    125.     
    126.     public ParameterMetaData getParameterMetaData() throws SQLException {    
    127.         return wrappedStatement.getParameterMetaData();    
    128.     }    
    129.     
    130.     public void setArray(int i, Array x) throws SQLException {    
    131.         wrappedStatement.setArray(i, x);    
    132.         saveQueryParamValue(i, x);    
    133.     }    
    134.     
    135.     public void setAsciiStream(int parameterIndex, InputStream x, int length)    
    136.             throws SQLException {    
    137.         wrappedStatement.setAsciiStream(parameterIndex, x, length);    
    138.         saveQueryParamValue(parameterIndex, x);    
    139.     }    
    140.     
    141.     public void setBigDecimal(int parameterIndex, BigDecimal x)    
    142.             throws SQLException {    
    143.         wrappedStatement.setBigDecimal(parameterIndex, x);    
    144.         saveQueryParamValue(parameterIndex, x);    
    145.     }    
    146.     
    147.     public void setBinaryStream(int parameterIndex, InputStream x, int length)    
    148.             throws SQLException {    
    149.         wrappedStatement.setBinaryStream(parameterIndex, x, length);    
    150.         saveQueryParamValue(parameterIndex, x);    
    151.     }    
    152.     
    153.     public void setBlob(int i, Blob x) throws SQLException {    
    154.         wrappedStatement.setBlob(i, x);    
    155.         saveQueryParamValue(i, x);    
    156.     }    
    157.     
    158.     public void setBoolean(int parameterIndex, boolean x) throws SQLException {    
    159.         wrappedStatement.setBoolean(parameterIndex, x);    
    160.         saveQueryParamValue(parameterIndex, new Boolean(x));    
    161.     }    
    162.     
    163.     public void setByte(int parameterIndex, byte x) throws SQLException {    
    164.         wrappedStatement.setByte(parameterIndex, x);    
    165.         saveQueryParamValue(parameterIndex, new Byte(x));    
    166.     }    
    167.     
    168.     public void setBytes(int parameterIndex, byte[] x) throws SQLException {    
    169.         wrappedStatement.setBytes(parameterIndex, x);    
    170.         saveQueryParamValue(parameterIndex, x);    
    171.     }    
    172.     
    173.     public void setCharacterStream(int parameterIndex, Reader reader, int length)    
    174.             throws SQLException {    
    175.         wrappedStatement.setCharacterStream(parameterIndex, reader, length);    
    176.         saveQueryParamValue(parameterIndex, reader);    
    177.     }    
    178.     
    179.     public void setClob(int i, Clob x) throws SQLException {    
    180.         wrappedStatement.setClob(i, x);    
    181.         saveQueryParamValue(i, x);    
    182.     }    
    183.     
    184.     public void setDate(int parameterIndex, Date x) throws SQLException {    
    185.         wrappedStatement.setDate(parameterIndex, x);    
    186.         saveQueryParamValue(parameterIndex, x);    
    187.     }    
    188.     
    189.     public void setDate(int parameterIndex, Date x, Calendar cal)    
    190.             throws SQLException {    
    191.         wrappedStatement.setDate(parameterIndex, x, cal);    
    192.         saveQueryParamValue(parameterIndex, x);    
    193.     }    
    194.     
    195.     public void setDouble(int parameterIndex, double x) throws SQLException {    
    196.         wrappedStatement.setDouble(parameterIndex, x);    
    197.         saveQueryParamValue(parameterIndex, new Double(x));    
    198.     }    
    199.     
    200.     public void setFloat(int parameterIndex, float x) throws SQLException {    
    201.         wrappedStatement.setFloat(parameterIndex, x);    
    202.         saveQueryParamValue(parameterIndex, new Float(x));    
    203.     }    
    204.     
    205.     public void setInt(int parameterIndex, int x) throws SQLException {    
    206.         wrappedStatement.setInt(parameterIndex, x);    
    207.         saveQueryParamValue(parameterIndex, new Integer(x));    
    208.     }    
    209.     
    210.     public void setLong(int parameterIndex, long x) throws SQLException {    
    211.         wrappedStatement.setLong(parameterIndex, x);    
    212.         saveQueryParamValue(parameterIndex, new Long(x));    
    213.     }    
    214.     
    215.     public void setNull(int parameterIndex, int sqlType) throws SQLException {    
    216.         wrappedStatement.setNull(parameterIndex, sqlType);    
    217.         saveQueryParamValue(parameterIndex, new Integer(sqlType));    
    218.     }    
    219.     
    220.     public void setNull(int paramIndex, int sqlType, String typeName)    
    221.             throws SQLException {    
    222.         wrappedStatement.setNull(paramIndex, sqlType, typeName);    
    223.         saveQueryParamValue(paramIndex, new Integer(sqlType));    
    224.     }    
    225.     
    226.     public void setObject(int parameterIndex, Object x) throws SQLException {    
    227.         wrappedStatement.setObject(parameterIndex, x);    
    228.         saveQueryParamValue(parameterIndex, x);    
    229.     }    
    230.     
    231.     public void setObject(int parameterIndex, Object x, int targetSqlType)    
    232.             throws SQLException {    
    233.         wrappedStatement.setObject(parameterIndex, x, targetSqlType);    
    234.         saveQueryParamValue(parameterIndex, x);    
    235.     }    
    236.     
    237.     public void setObject(int parameterIndex, Object x, int targetSqlType,    
    238.             int scale) throws SQLException {    
    239.         wrappedStatement.setObject(parameterIndex, x, targetSqlType, scale);    
    240.         saveQueryParamValue(parameterIndex, x);    
    241.     }    
    242.     
    243.     public void setRef(int i, Ref x) throws SQLException {    
    244.         wrappedStatement.setRef(i, x);    
    245.         saveQueryParamValue(i, x);    
    246.     }    
    247.     
    248.     public void setShort(int parameterIndex, short x) throws SQLException {    
    249.         wrappedStatement.setShort(parameterIndex, x);    
    250.         saveQueryParamValue(parameterIndex, new Short(x));    
    251.     }    
    252.     
    253.     public void setString(int parameterIndex, String x) throws SQLException {    
    254.         wrappedStatement.setString(parameterIndex, x);    
    255.         saveQueryParamValue(parameterIndex, x);    
    256.     }    
    257.     
    258.     public void setTime(int parameterIndex, Time x) throws SQLException {    
    259.         wrappedStatement.setTime(parameterIndex, x);    
    260.         saveQueryParamValue(parameterIndex, x);    
    261.     }    
    262.     
    263.     public void setTime(int parameterIndex, Time x, Calendar cal)    
    264.             throws SQLException {    
    265.         wrappedStatement.setTime(parameterIndex, x, cal);    
    266.         saveQueryParamValue(parameterIndex, x);    
    267.     }    
    268.     
    269.     public void setTimestamp(int parameterIndex, Timestamp x)    
    270.             throws SQLException {    
    271.         wrappedStatement.setTimestamp(parameterIndex, x);    
    272.         saveQueryParamValue(parameterIndex, x);    
    273.     }    
    274.     
    275.     public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)    
    276.             throws SQLException {    
    277.         wrappedStatement.setTimestamp(parameterIndex, x, cal);    
    278.         saveQueryParamValue(parameterIndex, x);    
    279.     }    
    280.     
    281.     public void setURL(int parameterIndex, URL x) throws SQLException {    
    282.         wrappedStatement.setURL(parameterIndex, x);    
    283.         saveQueryParamValue(parameterIndex, x);    
    284.     }    
    285.     
    286.     public void setUnicodeStream(int parameterIndex, InputStream x, int length)    
    287.             throws SQLException {    
    288.         wrappedStatement.setUnicodeStream(parameterIndex, x, length);    
    289.         saveQueryParamValue(parameterIndex, x);    
    290.     }    
    291.     
    292.     public void addBatch(String sql) throws SQLException {    
    293.         wrappedStatement.addBatch(sql);    
    294.     }    
    295.     
    296.     public void cancel() throws SQLException {    
    297.         wrappedStatement.cancel();    
    298.     }    
    299.     
    300.     public void clearBatch() throws SQLException {    
    301.         wrappedStatement.clearBatch();    
    302.     }    
    303.     
    304.     public void clearWarnings() throws SQLException {    
    305.         wrappedStatement.clearWarnings();    
    306.     }    
    307.     
    308.     public void close() throws SQLException {    
    309.         wrappedStatement.close();    
    310.     }    
    311.     
    312.     public boolean execute(String sql) throws SQLException {    
    313.         return wrappedStatement.execute(sql);    
    314.     }    
    315.     
    316.     public boolean execute(String sql, int autoGeneratedKeys)    
    317.             throws SQLException {    
    318.         return wrappedStatement.execute(sql, autoGeneratedKeys);    
    319.     }    
    320.     
    321.     public boolean execute(String sql, int[] columnIndexes) throws SQLException {    
    322.         return wrappedStatement.execute(sql, columnIndexes);    
    323.     }    
    324.     
    325.     public boolean execute(String sql, String[] columnNames)    
    326.             throws SQLException {    
    327.         return wrappedStatement.execute(sql, columnNames);    
    328.     }    
    329.     
    330.     public int[] executeBatch() throws SQLException {    
    331.         return wrappedStatement.executeBatch();    
    332.     }    
    333.     
    334.     public ResultSet executeQuery(String sql) throws SQLException {    
    335.         return wrappedStatement.executeQuery(sql);    
    336.     }    
    337.     
    338.     public int executeUpdate(String sql) throws SQLException {    
    339.         return wrappedStatement.executeUpdate(sql);    
    340.     }    
    341.     
    342.     public int executeUpdate(String sql, int autoGeneratedKeys)    
    343.             throws SQLException {    
    344.         return wrappedStatement.executeUpdate(sql, autoGeneratedKeys);    
    345.     }    
    346.     
    347.     public int executeUpdate(String sql, int[] columnIndexes)    
    348.             throws SQLException {    
    349.         return wrappedStatement.executeUpdate(sql, columnIndexes);    
    350.     }    
    351.     
    352.     public int executeUpdate(String sql, String[] columnNames)    
    353.             throws SQLException {    
    354.         return wrappedStatement.executeUpdate(sql, columnNames);    
    355.     }    
    356.     
    357.     public Connection getConnection() throws SQLException {    
    358.         return wrappedStatement.getConnection();    
    359.     }    
    360.     
    361.     public int getFetchDirection() throws SQLException {    
    362.         return wrappedStatement.getFetchDirection();    
    363.     }    
    364.     
    365.     public int getFetchSize() throws SQLException {    
    366.         return wrappedStatement.getFetchSize();    
    367.     }    
    368.     
    369.     public ResultSet getGeneratedKeys() throws SQLException {    
    370.         return wrappedStatement.getGeneratedKeys();    
    371.     }    
    372.     
    373.     public int getMaxFieldSize() throws SQLException {    
    374.         return wrappedStatement.getMaxFieldSize();    
    375.     }    
    376.     
    377.     public int getMaxRows() throws SQLException {    
    378.         return wrappedStatement.getMaxRows();    
    379.     }    
    380.     
    381.     public boolean getMoreResults() throws SQLException {    
    382.         return wrappedStatement.getMoreResults();    
    383.     }    
    384.     
    385.     public boolean getMoreResults(int current) throws SQLException {    
    386.         return wrappedStatement.getMoreResults(current);    
    387.     }    
    388.     
    389.     public int getQueryTimeout() throws SQLException {    
    390.         return wrappedStatement.getQueryTimeout();    
    391.     }    
    392.     
    393.     public ResultSet getResultSet() throws SQLException {    
    394.         return wrappedStatement.getResultSet();    
    395.     }    
    396.     
    397.     public int getResultSetConcurrency() throws SQLException {    
    398.         return wrappedStatement.getResultSetConcurrency();    
    399.     }    
    400.     
    401.     public int getResultSetHoldability() throws SQLException {    
    402.         return wrappedStatement.getResultSetHoldability();    
    403.     }    
    404.     
    405.     public int getResultSetType() throws SQLException {    
    406.         return wrappedStatement.getResultSetType();    
    407.     }    
    408.     
    409.     public int getUpdateCount() throws SQLException {    
    410.         return wrappedStatement.getUpdateCount();    
    411.     }    
    412.     
    413.     public SQLWarning getWarnings() throws SQLException {    
    414.         return wrappedStatement.getWarnings();    
    415.     }    
    416.     
    417.     public void setCursorName(String name) throws SQLException {    
    418.         wrappedStatement.setCursorName(name);    
    419.     }    
    420.     
    421.     public void setEscapeProcessing(boolean enable) throws SQLException {    
    422.         wrappedStatement.setEscapeProcessing(enable);    
    423.     }    
    424.     
    425.     public void setFetchDirection(int direction) throws SQLException {    
    426.         wrappedStatement.setFetchDirection(direction);    
    427.     }    
    428.     
    429.     public void setFetchSize(int rows) throws SQLException {    
    430.         wrappedStatement.setFetchSize(rows);    
    431.     }    
    432.     
    433.     public void setMaxFieldSize(int max) throws SQLException {    
    434.         wrappedStatement.setMaxFieldSize(max);    
    435.     }    
    436.     
    437.     public void setMaxRows(int max) throws SQLException {    
    438.         wrappedStatement.setMaxFieldSize(max);    
    439.     }    
    440.     
    441.     public void setQueryTimeout(int seconds) throws SQLException {    
    442.         wrappedStatement.setQueryTimeout(seconds);    
    443.     }  
    444.   
    445.     public void setAsciiStream(int parameterIndex, InputStream x)  
    446.             throws SQLException {  
    447.         // TODO Auto-generated method stub  
    448.           
    449.     }  
    450.   
    451.     public void setAsciiStream(int parameterIndex, InputStream x, long length)  
    452.             throws SQLException {  
    453.         // TODO Auto-generated method stub  
    454.           
    455.     }  
    456.   
    457.     public void setBinaryStream(int parameterIndex, InputStream x)  
    458.             throws SQLException {  
    459.         // TODO Auto-generated method stub  
    460.           
    461.     }  
    462.   
    463.     public void setBinaryStream(int parameterIndex, InputStream x, long length)  
    464.             throws SQLException {  
    465.         // TODO Auto-generated method stub  
    466.           
    467.     }  
    468.   
    469.     public void setBlob(int parameterIndex, InputStream inputStream)  
    470.             throws SQLException {  
    471.         // TODO Auto-generated method stub  
    472.           
    473.     }  
    474.   
    475.     public void setBlob(int parameterIndex, InputStream inputStream, long length)  
    476.             throws SQLException {  
    477.         // TODO Auto-generated method stub  
    478.           
    479.     }  
    480.   
    481.     public void setCharacterStream(int parameterIndex, Reader reader)  
    482.             throws SQLException {  
    483.         // TODO Auto-generated method stub  
    484.           
    485.     }  
    486.   
    487.     public void setCharacterStream(int parameterIndex, Reader reader,  
    488.             long length) throws SQLException {  
    489.         // TODO Auto-generated method stub  
    490.           
    491.     }  
    492.   
    493.     public void setClob(int parameterIndex, Reader reader) throws SQLException {  
    494.         // TODO Auto-generated method stub  
    495.           
    496.     }  
    497.   
    498.     public void setClob(int parameterIndex, Reader reader, long length)  
    499.             throws SQLException {  
    500.         // TODO Auto-generated method stub  
    501.           
    502.     }  
    503.   
    504.     public void setNCharacterStream(int parameterIndex, Reader value)  
    505.             throws SQLException {  
    506.         // TODO Auto-generated method stub  
    507.           
    508.     }  
    509.   
    510.     public void setNCharacterStream(int parameterIndex, Reader value,  
    511.             long length) throws SQLException {  
    512.         // TODO Auto-generated method stub  
    513.           
    514.     }  
    515.   
    516.     public void setNClob(int parameterIndex, NClob value) throws SQLException {  
    517.         // TODO Auto-generated method stub  
    518.           
    519.     }  
    520.   
    521.     public void setNClob(int parameterIndex, Reader reader) throws SQLException {  
    522.         // TODO Auto-generated method stub  
    523.           
    524.     }  
    525.   
    526.     public void setNClob(int parameterIndex, Reader reader, long length)  
    527.             throws SQLException {  
    528.         // TODO Auto-generated method stub  
    529.           
    530.     }  
    531.   
    532.     public void setNString(int parameterIndex, String value)  
    533.             throws SQLException {  
    534.         // TODO Auto-generated method stub  
    535.           
    536.     }  
    537.   
    538.     public void setRowId(int parameterIndex, RowId x) throws SQLException {  
    539.         // TODO Auto-generated method stub  
    540.           
    541.     }  
    542.   
    543.     public void setSQLXML(int parameterIndex, SQLXML xmlObject)  
    544.             throws SQLException {  
    545.         // TODO Auto-generated method stub  
    546.           
    547.     }  
    548.   
    549.     public boolean isClosed() throws SQLException {  
    550.         // TODO Auto-generated method stub  
    551.         return false;  
    552.     }  
    553.   
    554.     public boolean isPoolable() throws SQLException {  
    555.         // TODO Auto-generated method stub  
    556.         return false;  
    557.     }  
    558.   
    559.     public void setPoolable(boolean poolable) throws SQLException {  
    560.         // TODO Auto-generated method stub  
    561.           
    562.     }  
    563.   
    564.     public boolean isWrapperFor(Class<?> iface) throws SQLException {  
    565.         // TODO Auto-generated method stub  
    566.         return false;  
    567.     }  
    568.   
    569.     public <T> T unwrap(Class<T> iface) throws SQLException {  
    570.         // TODO Auto-generated method stub  
    571.         return null;  
    572.     }    
    573. }    

    输出:
    1. Connection conn = null;  
    2.         PreparedStatement ps = null;  
    3.         ResultSet rs = null;  
    4.         JdbcProp jp = new JdbcProp();  
    5.         try{  
    6.             String sql = " insert into someInfection_list (INFECTION_ID, INFECTION_CARDID, INFECTION_HOSADDRCODE, INFECTION_CARDSN, "  
    7.                 +" INFECTION_NAME, INFECTION_PARENTNAME, INFECTION_SEX, INFECTION_PHONE, INFECTION_IDSN, INFECTION_ORG,"  
    8.                 +" INFECTION_ADDR, INFECTION_ADDRCODE, INFECTION_ADDRTYPE, INFECTION_PERSONTYPE, INFECTION_TAKENDATE,"  
    9.                 +" INFECTION_DIAGNOSEDATE, INFECTION_DEADDATE, INFECTION_TYPE, INFECTION_DOCTOR, INFECTION_INFECTIONTYPE,"  
    10.                 +" infection_infectionsn, infection_zhongshendate, INFECTION_USERID, INFECTION_MEMO, INFECTION_BIRTHDAY,"  
    11.                 +" INFECTION_DOCTORFILLDATE , infection_oldcardid, INFECTION_CARDCREATEDDATE, infection_xianshen,"  
    12.                 +" infection_shishen, infection_shengshen, INFECTION_DELETEDATE, INFECTION_REPORTORG, INFECTION_ORGTYPE,"  
    13.                 +" INFECTION_REPAIRDATE, infection_flag, infection_datasource, infection_firstinfection) " +  
    14.                         " values " +  
    15.                     "(sys_guid(),?,?,?,?,?,?,?,?,?, " + //  10  
    16.                     "?,?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),to_date(?,'yyyy-mm-dd hh24:mi:ss'),to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,?, " +  
    17.                      "?, to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss')," +  //25  
    18.                     "to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),to_date(?,'yyyy-mm-dd hh24:mi:ss'),to_date(?,'yyyy-mm-dd hh24:mi:ss'), " +  
    19.                     "?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,?)";  
    20.             conn = jp.getConn();  
    21. //          ps = conn.prepareStatement(sql);  
    22.             ps = new LoggableStatement(conn,sql);    
    23.             ps.setString(1, paras[0]);  
    24.             ...  
    25.                         ...       
    26.             System.out.println("Executing SQL: "+((LoggableStatement)ps).getQueryString());   
    27.               
    28.             ps.executeUpdate();  


     
    0
    0
  • 相关阅读:
    IE11 Promise对象未定义错误--解决方法
    HTML中 li 标签的value属性兼容问题
    Oracle--树形自关联表查询SQL
    SVNTortoise--Branche和Merge操作
    console--API
    前端自动分环境打包(vue和ant design)
    typeScript入门(四)泛型
    typeScript入门(三)接口
    typeScript入门(二)函数与类
    typeScript入门(一)构建环境和数据类型
  • 原文地址:https://www.cnblogs.com/aipan/p/7237854.html
Copyright © 2011-2022 走看看