| | |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table
|
| | | + " ADD COLUMN `is_Smoke_CommErr3` tinyint(1) NOT NULL DEFAULT '0' COMMENT '烟感3通信故障';");
|
| | | }
|
| | | |
| | | |
| | | //添加acIn2_currA字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdcdata'"
|
| | | + " AND column_name='acIn2_currA'");
|
| | | |
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table |
| | | + " ADD COLUMN `acIn2_currA` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | //添加acIn2_currB字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdcdata'"
|
| | | + " AND column_name='acIn2_currB'");
|
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table |
| | | + " ADD COLUMN `acIn2_currB` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | //添加acIn2_currC字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdcdata'"
|
| | | + " AND column_name='acIn2_currC'");
|
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdcdata_Table |
| | | + " ADD COLUMN `acIn2_currC` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | |
| | | " `is_dc1_under_vol` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_dc2_over_vol` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_dc2_under_vol` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_dc_monitorerr` tinyint(1) NOT NULL," + |
| | | " `is_dc_monitorerr` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `is_tempalarm` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_trip` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn2_trip` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | |
| | | " `is_acIn1_under_volA` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_less_A` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_over_volB` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_under_volB` tinyint(1) NOT NULL," + |
| | | " `is_acIn1_under_volB` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `is_acIn1_less_B` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_over_volC` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | | " `is_acIn1_under_volC` tinyint(1) NOT NULL DEFAULT '0'," +
|
| | |
| | | " KEY `index_powerdev_id` (`PowerDeviceId`)" +
|
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | ResultSet res = null;
|
| | | try {
|
| | | if(true == recreate) {
|
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02); |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | |
| | | |
| | | //添加acIn2_currA字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdata'"
|
| | | + " AND column_name='acIn2_currA'");
|
| | | |
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table |
| | | + " ADD COLUMN `acIn2_currA` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | //添加acIn2_currB字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdata'"
|
| | | + " AND column_name='acIn2_currB'");
|
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table |
| | | + " ADD COLUMN `acIn2_currB` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | //添加acIn2_currC字段
|
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
|
| | | + " WHERE table_schema='db_pwrdev_data_rt'"
|
| | | + " AND table_name='tb_pwrdev_acdata'"
|
| | | + " AND column_name='acIn2_currC'");
|
| | | if(false == res.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Pwrdev_Acdata_Table |
| | | + " ADD COLUMN `acIn2_currC` float NOT NULL DEFAULT '0';");
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | public static void main(String[] args) {
|
| | | MysqlConnPool pool = new MysqlConnPool("192.168.10.112", 3360, 50);
|
| | | createPwrdev_Acdata_Table(pool, false);
|
| | | }
|
| | | }
|