日期:2014-05-20 浏览次数:20844 次
public Vector select(Object pojo,String condition , String conditionValue){
Vector v = new Vector();
GetConnection getConn = null ;
SQLFactory sf = new SQLFactory(pojo);
String sql = sf.createSql(
SQLFactory.SELECT,condition,conditionValue);
try{
getConn = new GetConnection();
conn = getConn.getConnection() ;
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
Vector tempV = new Vector();
tempV.add(rs.getInt(1));
tempV.add(rs.getString(2));
tempV.add(rs.getString(3));
tempV.add(rs.getString(4));
v.add(tempV);
}
}
catch(Exception err){
err.printStackTrace();
}
finally{
try {
System.out.println(rs);
if( null != rs
&& !rs.isClosed() )
rs.close();
rs = null ;
if( null != stat && !stat.isClosed())
stat.close();
stat = null ;
} catch (SQLException e) {
e.printStackTrace();
}
getConn.close();
conn = null ;
}
return v ;
}