admin 管理员组

文章数量: 1086019


2024年1月16日发(作者:十进制十六进制转换公式)

*/public static List executeQuery(Connection con, String sql, Class> c) throws SQLException{PreparedStatement pst = null;ResultSet rs = null;try {pst = eStatement(sql);rs = eQuery();return getListFromRs(rs, c);}finally{closeRs(rs);closePst(pst);}}/*** 得到结果集存储到list中* @param rs 查询的结果集* @return* @throws SQLException*/public static List> getListFromRs(ResultSet rs) throws SQLException{ResultSetMetaData md = aData();//得到结果集列的属性int columns = umnCount();//得到记录有多少列int i;List> list = new ArrayList>();while(()){Map map = new HashMap();for(i = 0; i

(umnName(i + 1), getValueByType(rs, umnType(i + 1), umnName(i + 1)));}(map);}return list;}/**

/**** 关闭数据库多个结果集* @param rss*/public static void rss){for(ResultSet rs: rss){if(rs != null){try {();} catch (SQLException e) {}}}}/*** 关闭数据库多个psts* @param psts*/public static void psts){for(Statement pst: psts){if(pst != null){try {();} catch (SQLException e) {}}}}/*** 关闭数据库所得到的多个链接* @param cons*/public static void cons){for(Connection con: cons){

if(con != null){try {();} catch (SQLException e) {}}}}}


本文标签: 得到 结果 转换 数据库 关闭