package com.thread;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import com.mode.Device_Inf;
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class Manage_Simul_SQL {
|
|
/**
|
* ¼ÓÔØËùÓеÄÉ豸
|
* @param gB_MysqlConnPool
|
* @param devices
|
*/
|
public static void queryAllDevice(MysqlConnPool pool, List<Device_Inf> devices) {
|
devices = new ArrayList<Device_Inf>();
|
String sql_str = " SELECT * FROM "+ Sql_Mysql.Tb_Device_Inf_Table;
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
ResultSet res = null;
|
try {
|
res = sql.sqlMysqlQuery(sql_str);
|
while(res.next()) {
|
Device_Inf dev = new Device_Inf();
|
dev.setDevice_id(res.getInt("device_id"));
|
dev.setDevice_ip(res.getString("device_ip"));
|
dev.setDevice_name(res.getString("device_name"));
|
dev.setMaint_cycle(res.getInt("maint_cycle"));
|
dev.setSystem_id(res.getInt("system_id"));
|
dev.setSystem_name(res.getString("system_name"));
|
dev.setUse_starttime(res.getDate("use_starttime"));
|
dev.setUser_id(res.getInt("user_id"));
|
devices.add(dev);
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
sql.close_con();
|
}
|
}
|
|
}
|