锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧美日韩国产成人综合一二三区 ,99久久伊人,国产精品一区毛片http://www.aygfsteel.com/heroking2000/category/6670.htmlzh-cnSat, 03 Mar 2007 09:04:15 GMTSat, 03 Mar 2007 09:04:15 GMT60涓涓畝媧佺殑鏁版嵁搴撹闂鏋?/title><link>http://www.aygfsteel.com/heroking2000/articles/26530.html</link><dc:creator>Hero King</dc:creator><author>Hero King</author><pubDate>Wed, 04 Jan 2006 03:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/heroking2000/articles/26530.html</guid><wfw:comment>http://www.aygfsteel.com/heroking2000/comments/26530.html</wfw:comment><comments>http://www.aygfsteel.com/heroking2000/articles/26530.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/heroking2000/comments/commentRss/26530.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/heroking2000/services/trackbacks/26530.html</trackback:ping><description><![CDATA[<P>      綆浠嬶細璇ユ鏋跺惛鍙朓Batis璁捐鎬濇兂鍜屾柟娉曟槧灝勬満鍒訛紝緇撳悎妯″紡鍖歸厤錛屽皢鏌ヨ緇撴灉鐩存帴鏄犲皠鎴愬煙瀵硅薄妯″瀷錛屽茍鏀寔鍒嗛〉銆?BR>      浠g爜濡備笅錛?BR>package heroking.db;</P> <P>import java.util.List;<BR>import java.util.ArrayList;<BR>import java.util.regex.Pattern;<BR>import java.util.regex.Matcher;<BR>import java.sql.*;</P> <P><BR>public class GeneralDao {<BR>    private Connection connection = null;</P> <P>    public Connection getConnection() {<BR>        return connection;<BR>    }</P> <P>    public void setConnection(Connection connection) {<BR>        this.connection = connection;<BR>    }</P> <P>    /**<BR>     * 鎵ц鎻掑叆錛屾洿鏂幫紝鍒犻櫎鎿嶄綔錛岃繑鍥炲間負褰卞搷璁板綍鏁般?BR>     * @param sql<BR>     * @param parameter<BR>     */<BR>    public int executeUpdate(String sql, Object parameter) {<BR>        List result = new ArrayList();<BR>        //鎸夋ā寮忓尮閰嶈漿鎹ql璇彞<BR>        Pattern pattern = Pattern.compile("#[a-zA-Z]+#");   //妯″紡鍖歸厤<BR>        Matcher matcher = pattern.matcher(sql);<BR>        String formatSql = matcher.replaceAll("?");<BR>        //榪炴帴鏁版嵁婧?BR>        PreparedStatement st = null;<BR>        try {<BR>            st = connection.prepareStatement(formatSql);<BR>        } catch (Exception e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        }<BR>        //娣誨姞棰勫鐞嗗弬鏁?BR>        int i = 1;<BR>        while (matcher.find()) {<BR>            String field = matcher.group();<BR>            String formatField = field.substring(1, field.length() - 1);<BR>            try {<BR>                st.setObject(i++, DataBaseUtil.excuteGetMethod(formatField, parameter));<BR>            } catch (SQLException e) {<BR>                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>            }<BR>        }<BR>        try {<BR>            return st.executeUpdate();<BR>        } catch (SQLException e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        }<BR>        return 0;<BR>    }<BR>    </P> <P>    /**<BR>     * 鏌ヨ絎琾ageCount欏甸潰錛堟瘡涓〉闈㈢殑璁板綍鏁頒負pageSize錛夌殑緇撴灉<BR>     * @param sql   sql鏌ヨ<BR>     * @param parameter 鍙傛暟瀵硅薄<BR>     * @param pageSize 欏甸潰緇撴灉闆嗗ぇ灝?BR>     * @param pageCount 欏甸潰鏁?BR>     * @param resultClass 緇撴灉綾?BR>     * @return List<BR>     */<BR>    public List executeQuerys(String sql, Object parameter, int pageSize, int pageCount, Class resultClass){<BR>        List result = new ArrayList();<BR>        //鎸夋ā寮忓尮閰嶈漿鎹ql璇彞<BR>        Pattern pattern = Pattern.compile("#[a-zA-Z]+#");   //妯″紡鍖歸厤<BR>        Matcher matcher = pattern.matcher(sql);<BR>        String formatSql = matcher.replaceAll("?");<BR>        //榪炴帴鏁版嵁婧?BR>        PreparedStatement st = null;<BR>        try {<BR>            //璁劇疆棰勫鐞嗙姸鎬佸弬鏁幫紝婊氬姩錛屽彧璇匯?BR>            st = connection.prepareStatement(formatSql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);<BR>        } catch (Exception e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        }<BR>        //娣誨姞棰勫鐞嗗弬鏁?BR>        int i = 1;<BR>        while (matcher.find()) {<BR>            String field = matcher.group();<BR>            String formatField = field.substring(1, field.length() - 1);<BR>            try {<BR>                st.setObject(i++, DataBaseUtil.excuteGetMethod(formatField, parameter));<BR>            } catch (SQLException e) {<BR>                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>            }<BR>        }<BR>        ResultSet rs = null;<BR>        try {<BR>            rs = st.executeQuery();<BR>            //鑾峰彇鎬昏褰曟暟<BR>            rs.last();<BR>            int totalCount = rs.getRow();</P> <P>            //褰撳墠欏甸潰絎竴鏉¤褰曚綅緗?BR>            int curPagePosition = (pageCount -1)*pageSize + 1;<BR>            if (totalCount < curPagePosition) {<BR>                return null;<BR>            }<BR>            rs.beforeFirst();<BR>            rs.absolute(curPagePosition);</P> <P>            //灝佽鍊煎璞?BR>            int k = 0;<BR>            ResultSetMetaData rsmd = rs.getMetaData();<BR>            int cols = rsmd.getColumnCount();<BR>            while (rs.next() && k < pageSize) {<BR>                Object o = resultClass.newInstance();<BR>                for (int j = 1; j <= cols; j++) {<BR>                    String name = rsmd.getColumnName(j);<BR>                    Object value = rs.getObject(j);//浣滈氱敤綾誨瀷澶勭悊,榪欐牱row涓殑綾誨瀷閮芥槸Object鍨嬬殑銆?BR>                    String voName = DataBaseUtil.toInValueName(name);<BR>                    DataBaseUtil.executeSetMethod(voName, value, o);<BR>                }<BR>                result.add(o);<BR>                k++;    //鑾峰彇鏁板姞1<BR>            }<BR>        } catch (SQLException e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        } catch (IllegalAccessException e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        } catch (InstantiationException e) {<BR>            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.<BR>        }<BR>        return result;<BR>    }<BR>    /**<BR>     * 鏌ヨ鎵鏈夌邯褰?BR>     * @param sql<BR>     * @param parameter<BR>     * @param resultClass<BR>     * @return List<BR>     */<BR>    public List executeQuerys(String sql, Object parameter, Class resultClass){<BR>        //榛樿涓烘墍鏈夎褰?BR>        return this.executeQuerys(sql, parameter, Integer.MAX_VALUE, 1, resultClass);<BR>    }</P> <P>    /**<BR>     * 鏌ヨ鍗曚釜璁板綍<BR>     * @param sql<BR>     * @param parameter<BR>     * @param resultClass<BR>     * @return Object<BR>     */<BR>    public Object executeQuery(String sql, Object parameter, Class resultClass){<BR>        List list = executeQuerys(sql, parameter,resultClass);<BR>        if (list == null || list.size() == 0) {<BR>            return null;<BR>        }<BR>        return list.get(0);<BR>    }<BR>}<BR></P><img src ="http://www.aygfsteel.com/heroking2000/aggbug/26530.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/heroking2000/" target="_blank">Hero King</a> 2006-01-04 11:15 <a href="http://www.aygfsteel.com/heroking2000/articles/26530.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> 主站蜘蛛池模板: <a href="http://" target="_blank">县级市</a>| <a href="http://" target="_blank">泾源县</a>| <a href="http://" target="_blank">曲靖市</a>| <a href="http://" target="_blank">从江县</a>| <a href="http://" target="_blank">建水县</a>| <a href="http://" target="_blank">福建省</a>| <a href="http://" target="_blank">黄陵县</a>| <a href="http://" target="_blank">敖汉旗</a>| <a href="http://" target="_blank">兴义市</a>| <a href="http://" target="_blank">桐庐县</a>| <a href="http://" target="_blank">西乡县</a>| <a href="http://" target="_blank">庆城县</a>| <a href="http://" target="_blank">鲁山县</a>| <a href="http://" target="_blank">化州市</a>| <a href="http://" target="_blank">汉中市</a>| <a href="http://" target="_blank">华坪县</a>| <a href="http://" target="_blank">杭锦旗</a>| <a href="http://" target="_blank">和林格尔县</a>| <a href="http://" target="_blank">兰州市</a>| <a href="http://" target="_blank">和静县</a>| <a href="http://" target="_blank">天等县</a>| <a href="http://" target="_blank">铜陵市</a>| <a href="http://" target="_blank">青冈县</a>| <a href="http://" target="_blank">迭部县</a>| <a href="http://" target="_blank">都昌县</a>| <a href="http://" target="_blank">河曲县</a>| <a href="http://" target="_blank">甘孜县</a>| <a href="http://" target="_blank">疏勒县</a>| <a href="http://" target="_blank">永安市</a>| <a href="http://" target="_blank">夹江县</a>| <a href="http://" target="_blank">红桥区</a>| <a href="http://" target="_blank">石阡县</a>| <a href="http://" target="_blank">平顺县</a>| <a href="http://" target="_blank">屯昌县</a>| <a href="http://" target="_blank">乌海市</a>| <a href="http://" target="_blank">庐江县</a>| <a href="http://" target="_blank">谷城县</a>| <a href="http://" target="_blank">连州市</a>| <a href="http://" target="_blank">象州县</a>| <a href="http://" target="_blank">兴义市</a>| <a href="http://" target="_blank">名山县</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>