請教banq以及各位熱心的網友,關於JdbcUtil

jacal發表於2006-05-08
Jdon框架下com.jdon.model.query中的JdbcUtil類

 /**
     * queryParam type only support String Integer Float or Long Double Bye Short
     * if you need operate other types, you must use JDBC directly!
     */
public  void setQueryParams(Collection queryParams,
            PreparedStatement ps) throws Exception {
        if ((queryParams == null) || (queryParams.isEmpty()))
            return;
        int i = 1;
        Object key = null;
        try {
            Iterator iter = queryParams.iterator();
        
            while (iter.hasNext()) {
                key = iter.next();
                UtilValidate s;
                if (key == null) return;
                if (key instanceof java.lang.String) {
                    String keyStrs = (String) key;
                    if (UtilValidate.isEmpty(keyStrs)) return;
                    ps.setString(i, keyStrs);
                } else if (key instanceof Integer) {
                    ps.setInt(i, ((Integer) key).intValue());
                } else if (key instanceof Float) {
                    ps.setFloat(i, ((Float) key).floatValue());
                } else if (key instanceof Long) {
                    ps.setLong(i, ((Long) key).longValue());
                } else if (key instanceof Double) {
                    ps.setDouble(i, ((Double) key).doubleValue());
                } else if (key instanceof Byte) {
                    ps.setByte(i, ((Byte) key).byteValue());                          
                } else if (key instanceof Short) {
                    ps.setShort(i, ((Short) key).shortValue());                  
                } else if (key instanceof Clob) {
                  
                  StringBufferInputStream sbin = new StringBufferInputStream(key);
                  ps.setAsciiStream(i,sbin,1);
                 //   ps.setClob(i,(Clob) key);
                }
                  
                logger.debug("[JdonFramework] parameter " + i + " = " + key.toString());
                i++;
            }
        } catch (SQLException e) {
           logger.error("setQueryParams error " + e + "in parameter order=" + i + " its value=" + key);
        }

    }
<p class="indent">


中setQueryParams方法前的註釋:

 /**
     * queryParam type only support String Integer Float or Long Double Bye Short
     * if you need operate other types, you must use JDBC directly!
     */
<p class="indent">


意思是在傳入的引數中,只支援 String Integer Float or Long Double Bye Short資料型別,如果我需要支援oracle的Clob或者是Blob資料型別,該如何實現呢?我google了很多操作clob的方法,但不知道這些方法在jdon中該如何去實現?
請求幫忙看看

相關文章