?? dbmanager.java
字號:
package com.publish.shop.util.db;import java.sql.*;import com.publish.shop.util.javabeans.Debug;import com.publish.shop.util.javabeans.ShopException;public class DbManager{ /** * @param sql * @return int * @throws PmmvsException */ public static int executeUpdate(String sql) throws Exception { Debug.println("update,delete,insert: "+sql); int rs = 0; Connection con = null; Statement stmt = null; try { con = DbPool.getConnection(); stmt = con.createStatement(); rs = stmt.executeUpdate(sql); con.commit(); } catch(Exception sqlEx) { throw sqlEx; } finally { DbPool.closeStatement(stmt); DbPool.closeConnection(con); } return rs; } /** * @param sql * @return int * @throws PmmvsException */ public static int executeUpdate(Connection con, String sql) throws Exception { Debug.println("update: " + sql); int rs = 0; Statement stmt = null; try { stmt = con.createStatement(); rs = stmt.executeUpdate(sql); } catch(Exception sqlEx) { throw sqlEx; } finally { DbPool.closeStatement(stmt); } return rs; } public static String replaceString(String str) { if (str!=null && str.length()>0) { str = str.replace('*', '&'); str = str.replace('?', '-'); } return str; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -