📄 templetmanager.java
字号:
/* * TempletManager.java * * Created on 2002年4月26日, 上午11:21 */package com.gs.templet;import java.util.*;import com.gs.db.dbimp.*;import com.gs.db.*;import com.gs.util.Cacheable;import com.gs.util.CacheSizes;import java.util.Iterator;import java.util.ArrayList;import java.util.Date;import java.sql.*;public class TempletManager extends Object {private static final String GET = "select * from templet";private static final String GET_ID = "select * from templet where id = ?";private static final String GET_NAME = "select * from templet where name = ?";private static final String DELETE_ID = "delete from templet where id=?";private static final String DELETE_NAME = "delete from templet where name=?"; private static Object lock = new Object();Authorization authorization;IofficePermissions permissions;private Templet tp = null; /** Creates new TempletManager */ public TempletManager(Authorization authorization,IofficePermissions permissions) { this.authorization = authorization; this.permissions = permissions; } public Templet getTemplet(int id) { Connection con = null; PreparedStatement pstmt = null; try { con = DbConnectionManager.getConnection(); pstmt = con.prepareStatement(GET_ID); pstmt.setInt(1,id); ResultSet rs = pstmt.executeQuery(); if(rs.next()) { tp = new Templet(rs.getInt(1),rs.getString(2), rs.getString(3),rs.getString(4),rs.getInt(5),rs.getInt(6),rs.getInt(7),rs.getInt(8)); } } catch(Exception e) { } finally { try { pstmt.close(); } catch (Exception e) { e.printStackTrace(); } try { con.close(); } catch (Exception e) { e.printStackTrace(); } return tp; } } public ArrayList getTemplets() { Connection con = null; PreparedStatement pstmt = null; ArrayList list = new ArrayList(); try { con = DbConnectionManager.getConnection(); pstmt = con.prepareStatement(GET); ResultSet rs = pstmt.executeQuery(); while(rs.next()) { tp = new Templet(rs.getInt(1),rs.getString(2), rs.getString(3),rs.getString(4),rs.getInt(5),rs.getInt(6),rs.getInt(7),rs.getInt(8)); list.add(tp); } } catch(Exception e) { } finally { try { pstmt.close(); } catch (Exception e) { e.printStackTrace(); } try { con.close(); } catch (Exception e) { e.printStackTrace(); } return list; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -