From 4d32a9903a11f33cf0e14da25f1e7286b50258f6 Mon Sep 17 00:00:00 2001 From: Administrator <1525436766@qq.com> Date: 星期二, 27 七月 2021 16:08:31 +0800 Subject: [PATCH] V1.63 edit at date 2021-07-27 1.表'db_ram_db.tb_fbs9100_setparam'新增恒流参数字段 --- BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java | 107 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 89 insertions(+), 18 deletions(-) diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java b/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java index 887c366..822f029 100644 --- a/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java +++ b/BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java @@ -605,14 +605,73 @@ " PRIMARY KEY (num)" + ") ENGINE=InnoDB AUTO_INCREMENT=1 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); + + //添加字段app_conn_max + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_server_state'" + + " AND column_name='app_conn_max'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.ServerState_Table + + " ADD COLUMN app_conn_max int(11) NOT NULL DEFAULT '0';"); + } + + //添加字段app_busy_conn_cnt + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_server_state'" + + " AND column_name='app_busy_conn_cnt'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.ServerState_Table + + " ADD COLUMN app_busy_conn_cnt int(11) NOT NULL DEFAULT '0';"); + } + + //添加字段app_idle_conn_cnt + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_server_state'" + + " AND column_name='app_idle_conn_cnt'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.ServerState_Table + + " ADD COLUMN app_idle_conn_cnt int(11) NOT NULL DEFAULT '0';"); + } + + //添加字段server_cpu_rate + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_server_state'" + + " AND column_name='server_cpu_rate'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.ServerState_Table + + " ADD COLUMN server_cpu_rate float NOT NULL DEFAULT '0';"); + } + + //添加字段 server_network_rate + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_server_state'" + + " AND column_name='server_network_rate'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.ServerState_Table + + " ADD COLUMN server_network_rate float NOT NULL DEFAULT '0';"); + } + } catch (SQLException e) { e.printStackTrace(); } finally { + if(null != res) { + try { + res.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } sql.close_con(); } } @@ -1246,22 +1305,15 @@ public static void createBTSGPRSState_Table(MysqlConnPool pool, boolean recreate) { String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BTSGPRSState_Table; String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSGPRSState_Table + " (" + - " num bigint(20) NOT NULL AUTO_INCREMENT," + - " station_id bigint(20) NOT NULL DEFAULT '0'," + - " dev_id bigint(20) NOT NULL DEFAULT '0'," + - " record_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_stat int(11) NOT NULL DEFAULT '0'," + - " station_poff_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_fadian_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_diaozhan_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_temp float NOT NULL DEFAULT '0'," + - " station_damp float NOT NULL DEFAULT '0'," + - " station_dooropen_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_xuhang_start_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " station_xuhang_end_time varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + - " PRIMARY KEY (num)," + - " UNIQUE KEY index_station_id_uniq (station_id)" + - ") ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;"; + " `num` bigint(20) NOT NULL AUTO_INCREMENT," + + " `dev_id` bigint(20) NOT NULL DEFAULT '0'," + + " `op_cmd` int(11) NOT NULL DEFAULT '0'," + + " `AT_cmd` varchar(20) NOT NULL DEFAULT ''," + + " `ack_inf` varchar(50) NOT NULL DEFAULT ''," + + " `bts_task_inf` varchar(1024) NOT NULL DEFAULT ''," + + " PRIMARY KEY (`num`)," + + " UNIQUE KEY `index_dev_id_uniq` (`dev_id`)" + + ") ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;"; Sql_Mysql sql = new Sql_Mysql(pool.getConn()); try { if(true == recreate) { @@ -1372,11 +1424,30 @@ " KEY index_BattGroupId (BattGroupId)" + ") ENGINE=InnoDB AUTO_INCREMENT=347 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); + //添加字段mon_JH_curr + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_batt_rtdata'" + + " AND column_name='mon_JH_curr'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtData_Table + + " ADD COLUMN mon_JH_curr float NOT NULL DEFAULT '0';"); + } + //添加字段mon_LY_vol + res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" + + " WHERE table_schema='db_ram_db'" + + " AND table_name='tb_batt_rtdata'" + + " AND column_name='mon_LY_vol'"); + if(false == res.next()) { + sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtData_Table + + " ADD COLUMN mon_LY_vol float NOT NULL DEFAULT '0';"); + } } catch (SQLException e) { e.printStackTrace(); } finally { -- Gitblit v1.9.1