📄 dbsqlmanager.java
字号:
package barbershop.database;
import java.sql.*;
import barbershop.database.*;
public class DBSQLManager
{
protected Connection conn = null;
protected Statement stmt = null;
protected ResultSet rs = null;
protected String sqlStr;
public DBSQLManager()
{
try
{
sqlStr = "";
DBConnection dcm = new DBConnection();
conn = dcm.getConnection();
stmt = conn.createStatement();
}
catch(Exception e)
{
System.out.println(e);
}
}
public Statement getStmt()
{
return stmt;
}
public Connection getConn()
{
return conn;
}
public ResultSet getRs()
{
return rs;
}
public void setSqlStr(String sqlStr)
{
this.sqlStr = sqlStr;
}
public String getSqlStr()
{
return sqlStr;
}
public void executeQuery() throws Exception
{
rs = stmt.executeQuery(sqlStr);
}
public void executeUpdate() throws Exception
{
stmt.executeUpdate(sqlStr);
}
public void close() throws SQLException
{
if(stmt != null)
{
stmt.close();
stmt = null;
}
conn.close();
conn = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -