📄 processorsdao.java~44~
字号:
package pcdiysystem.Dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Vector;
import pcdiysystem.Beans.ProcessorsBean;
/**
* <p>Title: 自助装机系统</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author kamiiiyu
* @version 1.0
*/
public class ProcessorsDAO {
public ProcessorsDAO() {
}
public ArrayList getProcessorsListByManufacturer(String manufacturer){
ArrayList list=new ArrayList();
Connection dbConnection=null;
PreparedStatement pStatement=null;
ResultSet resultSet=null;
try {
dbConnection = ConnectionManager.getConnection();
if(dbConnection!=null)
System.out.println("OK!");
String proList = "select p.* from processors as p left outer join Manufacturersofprocessor as ma on ma.Manufacturerid=p.manufacturerid where ma.manufacturer=?";
pStatement = dbConnection.prepareStatement(proList);
pStatement.setString(1, manufacturer);
resultSet=pStatement.executeQuery();
while(resultSet.next()){
ProcessorsBean pb=new ProcessorsBean();
pb.setManufacturerId(resultSet.getString(2));
pb.setType(resultSet.getString(3));
pb.setClockSpeed(resultSet.getString(4));
pb.setFsbs(resultSet.getString(5));
pb.setSocket(resultSet.getString(6));
pb.setPrice(resultSet.getString(7));
pb.setSocket(resultSet.getString(8));
pb.setDescription(resultSet.getString(9));
list.add(pb);
}
}
catch (SQLException ex) {
}finally{
ConnectionManager.closeResultSet(resultSet);
ConnectionManager.closeStatement(pStatement);
ConnectionManager.closeConnection(dbConnection);
}
return list;
}
public Vector getBaseInfomation(String manufacturer){
Vector list=new Vector();
Connection dbConnection=null;
PreparedStatement pStatement=null;
ResultSet resultSet=null;
try {
dbConnection = ConnectionManager.getConnection();
if(dbConnection!=null)
System.out.println("OK!");
String proList = "select p.* from processors as p left outer join Manufacturersofprocessor as ma on ma.Manufacturerid=p.manufacturerid where ma.manufacturer=?";
pStatement = dbConnection.prepareStatement(proList);
pStatement.setString(1, manufacturer);
resultSet=pStatement.executeQuery();
while(resultSet.next()){
Vector temp=new Vector();
temp.add(resultSet.getString(3));
temp.add(resultSet.getString(4));
temp.add(resultSet.getString(5));
temp.add(resultSet.getString(6));
//temp.add(resultSet.getString(7));
temp.add(resultSet.getString(8));
temp.add(resultSet.getString(9));
list.add(temp);
}
}
catch (SQLException ex) {
}finally{
ConnectionManager.closeResultSet(resultSet);
ConnectionManager.closeStatement(pStatement);
ConnectionManager.closeConnection(dbConnection);
}
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -