Ejemplo n.º 1
0
 public String getQueryString() {
   StringBuffer buf = new StringBuffer();
   int qMarkCount = 0;
   int qPos = 0;
   StringTokenizer tok = new StringTokenizer(sqlTemplate + " ", "?");
   while (tok.hasMoreTokens()) {
     String oneChunk = tok.nextToken();
     buf.append(oneChunk);
     // Log.info("=== size :: " + params.size(), this);
     // Log.info("=== qMarkCount :: " + qMarkCount, this);
     try {
       Object value;
       String value_type = "";
       if (params.size() > 0 + qMarkCount) {
         qPos = qMarkCount++;
         value = params.get(0 + qPos);
         value_type = (String) params_type.get(0 + qPos);
       } else {
         if (tok.hasMoreTokens()) {
           value = null;
         } else {
           value = "";
         }
       }
       if (value_type.equals("String")) buf.append("					'" + value + "'");
       else buf.append("					" + value);
     } catch (Throwable e) {
       buf.append("ERROR WHEN PRODUCING QUERY STRING FOR LOG." + e.toString());
       Log.error(buf.toString(), this);
       // catch this without whining, if this fails the only thing wrong is probably this class
     }
   }
   return buf.toString().trim();
 }
Ejemplo n.º 2
0
 public void close() throws SQLException {
   try {
     statement.close();
   } catch (SQLException e) {
     Log.error("pstmt close error => " + e, this);
     throw e;
   }
 }
Ejemplo n.º 3
0
 public boolean execute(String sql, String[] columnNames) throws SQLException {
   try {
     return statement.execute(sql, columnNames);
   } catch (SQLException se) {
     Log.error(se.toString(), this);
     throw se;
   } finally {
   }
 }
Ejemplo n.º 4
0
 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
   try {
     return statement.execute(sql, autoGeneratedKeys);
   } catch (SQLException se) {
     Log.error(se.toString(), this);
     throw se;
   } finally {
   }
 }
Ejemplo n.º 5
0
 public int[] executeBatch() throws SQLException {
   try {
     return statement.executeBatch();
   } catch (SQLException se) {
     Log.error(se.toString(), this);
     throw se;
   } finally {
   }
 }
Ejemplo n.º 6
0
 public int executeUpdate(String sql, String[] columnNames) throws SQLException {
   int result = 0;
   try {
     result = statement.executeUpdate(sql, columnNames);
   } catch (SQLException se) {
     Log.error(se.toString(), this);
     throw se;
   } finally {
   }
   return result;
 }
Ejemplo n.º 7
0
 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
   int result = 0;
   try {
     result = statement.executeUpdate(sql, autoGeneratedKeys);
   } catch (SQLException se) {
     Log.error(se.toString(), this);
     throw se;
   } finally {
   }
   return result;
 }