From a11f546d2548fa57a5529769013d0bd32bffa768 Mon Sep 17 00:00:00 2001
From: whyclj <1525436766@qq.com>
Date: 星期三, 10 六月 2020 11:49:48 +0800
Subject: [PATCH] 修复dev_version过短bug

---
 BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java b/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
index dfd4618..0225d1c 100644
--- a/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
+++ b/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
@@ -11,7 +11,7 @@
 public class FBS9100_Task_Thread_SQL {
 	
 	/**
-	 * 创建 tb_fbs9100_state 表并且将设备id和设备hip插入到表中
+	 * 	创建 tb_fbs9100_state 表并且将设备id和设备hip插入到表中
 	 * @param con_pool
 	 * @param al_param
 	 */
@@ -21,7 +21,7 @@
 		String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100State_Table
 					+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
 					+ "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
-					+ "`dev_version` varchar(20) NOT NULL DEFAULT '0', "
+					+ "`dev_version` varchar(64) NOT NULL DEFAULT '0', "
 					+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
 					+ "`op_cmd` INT NOT NULL DEFAULT 0, "
 					+ "`record_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
@@ -73,6 +73,15 @@
 				sql.sqlMysqlExecute(str1);
 			}
 			sql.sqlMysqlExecute(str2);
+			//修复设备设备版本号过长bug
+			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
+					+ " WHERE table_schema='db_ram_db'"
+					+ " AND table_name='tb_fbs9100_state'"
+					+ " AND column_name='dev_version'");
+			if(true == res.next()) {
+				sql.sqlMysqlExecute("ALTER TABLE " +Sql_Mysql.FBS9100State_Table + " MODIFY COLUMN dev_version varchar(64) NOT NULL DEFAULT '';");
+			}
+			
 			//添加设备温度列
 			res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
 					+ " WHERE table_schema='db_ram_db'"
@@ -690,10 +699,10 @@
 	}
 	
 	public static void main(String[] args) {
-		MysqlConnPool pool = new MysqlConnPool("", 3360, 100);
+		MysqlConnPool pool = new MysqlConnPool("127.0.0.1", 3360, 100);
 		FBS9100_Task_Thread_SQL thread = new FBS9100_Task_Thread_SQL();
-		thread.createFBS9100SetTestParamTableOnRam(pool, false);
-		
+		//thread.createFBS9100SetTestParamTableOnRam(pool, false);
+		thread.createFBS9100StateTableOnRam(pool, false);
 		
 	}
 	

--
Gitblit v1.9.1