package com.power.alarm;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
|
import com.power.mysql.MysqlConnPool;
|
import com.power.mysql.Sql_Mysql;
|
|
public class PwrDeviceAlarm_Thread_SQL {
|
|
/**
|
* ¶ÁÈ¡ÊÇ·ñÐèÒª¸üеçÔ´¸æ¾¯²ÎÊý
|
* @param pool
|
* @return
|
*/
|
public static int quereyAlarmThreadParam(MysqlConnPool pool) {
|
int thread_en = 0;
|
String sql_str = "SELECT * FROM web_site.tb_thread_util WHERE thread_id = 2019003";
|
ResultSet res = null;
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
res = sql.sqlMysqlQuery(sql_str);
|
if(res.next()) {
|
thread_en = res.getInt("thread_en");
|
}
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
} finally {
|
if(null != res) {
|
try {
|
res.close();
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
sql.close_con();
|
}
|
return thread_en;
|
}
|
|
/**
|
* ¶ÁÈ¡ÊÇ·ñÐèÒª¸üеçÔ´¸æ¾¯²ÎÊý
|
* @param pool
|
* @return
|
*/
|
public static int updateAlarmThreadParam(MysqlConnPool pool,int thread_en) {
|
String sql_str = " UPDATE web_site.tb_thread_util" +
|
" SET thread_en = " + thread_en +
|
" WHERE thread_id = 2019003";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
} finally {
|
sql.close_con();
|
}
|
return thread_en;
|
}
|
}
|