Example #1
0
 private PreparedStatement getPreparedStatement() throws SQLException {
   PreparedStatement tmpPreStat = conn.prepareStatement(sql);
   for (int i = 0; i < params.length; i++) {
     tmpPreStat.setObject(i + 1, params[i]);
   }
   return tmpPreStat;
 }
Example #2
0
 @Override
 public List<?> queryByClass(Class<? extends Object> clazz) throws SQLException {
   preStat = conn.prepareStatement(sql);
   rs = preStat.executeQuery();
   list.clear();
   while (rs.next()) {
     list.add(mapping(rs, clazz));
   }
   return list;
 }
Example #3
0
 @Override
 public List<?> getPageQuery(Class<? extends Object> clazz, int page, int size)
     throws SQLException {
   setPageAndSize(page, size);
   sql = pageUtil.getPageCmd(sql);
   preStat = conn.prepareStatement(sql);
   rs = preStat.executeQuery();
   list.clear();
   while (rs.next()) {
     list.add(mapping(rs, clazz));
   }
   return list;
 }
Example #4
0
 @Override
 public List<Map<String, Object>> queryForMapList() throws SQLException {
   preStat = conn.prepareStatement(sql);
   rs = preStat.executeQuery();
   mapList.clear();
   Map<String, Object> map = null;
   ResultSetMetaData rsm = rs.getMetaData();
   int cnt = rsm.getColumnCount();
   while (rs.next()) {
     map = new HashMap<String, Object>(cnt);
     for (int i = 0; i < cnt; i++) {
       map.put(rsm.getColumnName(i), rs.getObject(i));
     }
     mapList.add(map);
   }
   return mapList;
 }
Example #5
0
 @Override
 public ResultSet OriginalQuery() throws SQLException {
   preStat = conn.prepareStatement(sql);
   rs = preStat.executeQuery();
   return rs;
 }