| | |
| | | " batt_rest_power2_time int(11) NOT NULL DEFAULT '0'," + |
| | | " test_loadertype int(11) NOT NULL DEFAULT '0'," + |
| | | " test_recordnum int(11) NOT NULL DEFAULT '0'," + |
| | | " `dev_temperature` float NOT NULL DEFAULT '0' COMMENT '温度传感器温度'," + |
| | | " `dev_humidity` float NOT NULL DEFAULT '0' COMMENT '温度传感器湿度'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_BattGroupId (BattGroupId)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=8 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); |
| | | |
| | | //温度传感器温度 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_batt_rtstate'" |
| | | + " AND column_name='dev_temperature'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table |
| | | + " ADD COLUMN `dev_temperature` float NOT NULL DEFAULT '0' COMMENT '温度传感器温度'"); |
| | | } |
| | | |
| | | //温度传感器湿度 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_ram_db'" |
| | | + " AND table_name='tb_batt_rtstate'" |
| | | + " AND column_name='dev_humidity'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table |
| | | + " ADD COLUMN `dev_humidity` float NOT NULL DEFAULT '0' COMMENT '温度传感器湿度'"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |