From abffbf4d0cbda3dea8128f6c2c323a51a29f6dfa Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期三, 13 七月 2022 16:36:47 +0800
Subject: [PATCH] V1.36 edit at date 2022-07-13 	1.新增'db_dev_testparam'放电参数记录数据库-----------------每次记录充放电数据便会记录当前的充放电参数

---
 BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java b/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
index 9fbbab0..9faee40 100644
--- a/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
+++ b/BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -35,6 +35,7 @@
 	
 	final public static String DB_DEV_HISTORY = "`db_dev_history`";								//设备历史实时数据库
 	
+	final public static String DB_DEV_TESTPARAM = "`db_dev_testparam`";								//设备历史实时数据库
 	//--------------------------------------------------------------------------------------------//
 	public final static String TB_HardDevSmsState = "tb_hard_dev_sms_state";
 	//--------------------------------------------------------------------------------------------//
@@ -315,6 +316,9 @@
 	/***************************** db_fbo_testdata 数据库  ************************************/
 	public final static String Fbotestdata_Inf_Table = DB_FBO_TESTDATA + ".`tb_fbotestdata_inf`";
 	
+	
+	/***************************** db_dev_testparam 数据库  **********************************/
+	public final static String Batt_TestParam_Table = DB_DEV_TESTPARAM + ".tb_batt_testparam_";				//设备放电参数记录表
 	
 		
 	//--------------------------------------------------------------------------------------------//
@@ -1157,6 +1161,41 @@
 		return exist;
 	}
 	
+	/**
+	 *	 检查tb表是否存在
+	 * @param tb 表名不带数据库名
+	 * @return true:存在   false:不存在
+	 * @throws SQLException
+	 */
+	public boolean sqlCheckIfTableExist(String tb)
+	{
+		String sql_str = " SELECT COUNT(*) as count FROM information_schema.TABLES " + 
+						 " WHERE table_name ='" + tb + "';";
+		ResultSet res = sqlMysqlQuery(sql_str);
+		boolean exist = false;
+		try {
+			if (null != res && res.next()) {
+				int count = res.getInt("count");
+				if(count > 0) {
+					exist = true;
+				}
+			} 
+		} catch (Exception e) {
+			
+		} finally{
+			if(null != res) {
+				try {
+					res.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
+				}
+			}
+		}		
+		return exist;
+	}
+	
+
+	
 	//执行sql语句
 	public void sqlMysqlExecute(String sql_str) throws SQLException
 	{
@@ -1191,11 +1230,9 @@
 				}
 				mysql_con.setAutoCommit(true);
 			} catch (SQLException e1) {
-				// TODO Auto-generated catch block
 				e1.printStackTrace();
 			}
-		}
-		
+		}		
 		return exe_res;
 	}
 	

--
Gitblit v1.9.1