📄 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 + -