예제 #1
0
 public long getLong(int n) {
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return 0;
     return rs.getLong(n);
   } catch (Exception e) {
     Debug.warning(e);
   }
   return 0;
 }
예제 #2
0
 public int getInteger(int n) {
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return 0;
     return rs.getInt(n);
   } catch (Exception e) {
     Debug.warning(e);
   }
   return 0;
 }
예제 #3
0
 public long getDate(int n) {
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return 0;
     Date ts = rs.getDate(n);
     return ts.getTime();
   } catch (Exception e) {
     Debug.warning(e);
   }
   return 0;
 }
예제 #4
0
 public long getTimestamp(String name) {
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return 0;
     Timestamp ts = rs.getTimestamp(name);
     return ts.getTime();
   } catch (Exception e) {
     Debug.warning(e);
   }
   return 0;
 }
예제 #5
0
 public String getString(int n) {
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return "";
     byte[] str_b = rs.getBytes(n);
     return new String(str_b);
   } catch (Exception e) {
     Debug.warning(e);
   }
   return "";
 }
예제 #6
0
 public boolean query(String sql) {
   try {
     Statement stmt = getStatement();
     if (stmt != null) stmt.close();
     ResultSet rs = getResultSet();
     if (rs != null) rs.close();
     Connection con = getConnection();
     if (con == null) return false;
     stmt = con.createStatement();
     setStatement(stmt);
     rs = stmt.executeQuery(sql);
     setResultSet(rs);
   } catch (Exception e) {
     Debug.warning(e);
     return false;
   }
   return true;
 }
예제 #7
0
 public boolean fetch() {
   boolean fetchRet = false;
   try {
     ResultSet rs = getResultSet();
     if (rs == null) return false;
     fetchRet = rs.next();
     if (!fetchRet) {
       Statement stmt = getStatement();
       if (stmt != null) {
         stmt.close();
         setStatement(null);
       }
       rs.close();
       setResultSet(null);
     }
   } catch (Exception e) {
     Debug.warning(e);
   }
   return fetchRet;
 }
예제 #8
0
 public int update(String sql) {
   int numOfUpdated = 0;
   try {
     Statement stmt = getStatement();
     if (stmt != null) {
       stmt.close();
       setStatement(null);
     }
     ResultSet rs = getResultSet();
     if (rs != null) {
       rs.close();
       setResultSet(null);
     }
     Connection con = getConnection();
     if (con == null) return 0;
     stmt = con.createStatement();
     numOfUpdated = stmt.executeUpdate(sql);
     stmt.close();
   } catch (Exception e) {
     Debug.warning(e);
   }
   return numOfUpdated;
 }