package com.database_util;
|
|
import java.sql.SQLException;
|
import java.util.Date;
|
|
import com.base.Com;
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class DB_Fbo_testdata {
|
public static void init(MysqlConnPool pool, boolean recreate) {
|
System.out.println(" db_fbo_testdata init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
|
createDB_FBO_TESTDATA(pool);
|
|
createFbotestdata_Inf_Table(pool, recreate); //´´½¨ÀúÊ·Êý¾Ýinf±í
|
|
System.out.println(" db_fbo_testdata init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
}
|
|
/**
|
* ´´½¨ db_param Êý¾Ý¿â
|
* @param pool
|
*/
|
public static void createDB_FBO_TESTDATA(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_FBO_TESTDATA);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbotestdata_inf ±í
|
* @param pool
|
* @param recreate
|
*/
|
public static void createFbotestdata_Inf_Table(MysqlConnPool pool, boolean recreate) {
|
String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Fbotestdata_Inf_Table;
|
String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Fbotestdata_Inf_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '0' COMMENT 'µç³Ø×éID'," +
|
" `test_record_count` int(11) NOT NULL DEFAULT '0' COMMENT '·Åµç±ÊÊý'," +
|
" `test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '²âÊÔ¿ªÊ¼Ê±¼ä'," +
|
" `test_timelong` int(11) NOT NULL DEFAULT '0' COMMENT '²âÊÔʱ³¤'," +
|
" `device` int(11) NOT NULL DEFAULT '0' COMMENT 'ÒDZíÀàÐÍ'," +
|
" `test_type` int(11) NOT NULL DEFAULT '0' COMMENT '²âÊÔÀàÐÍ'," +
|
" `hourrate` int(11) NOT NULL DEFAULT '0' COMMENT 'СʱÂÊ'," +
|
" `save_interval` int(11) NOT NULL DEFAULT '0' COMMENT '²É¼¯¼ä¸ô'," +
|
" `monomervol` float NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåµçѹÀàÐÍ'," +
|
" `moncapstd` float NOT NULL DEFAULT '0' COMMENT '±ê³ÆÈÝÁ¿'," +
|
" `test_curr` float NOT NULL DEFAULT '0' COMMENT '²âÊÔµçÁ÷'," +
|
" `test_cap` float NOT NULL DEFAULT '0' COMMENT '²âÊÔÈÝÁ¿'," +
|
" `monvol_limit` float NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÏÂÏÞ'," +
|
" `gourpvol_limit` float NOT NULL DEFAULT '0' COMMENT '×é¶ËÏÂÏÞ'," +
|
" `mon_count` int(11) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÊýÁ¿'," +
|
" `monvol_limitcount` int(11) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÏÂÏÞÊýÁ¿'," +
|
" `stop_type` int(11) NOT NULL DEFAULT '0' COMMENT '½áÊø·½Ê½'," +
|
" `download_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT 'ÉÏ´«Ê±¼ä'," +
|
" PRIMARY KEY (`num`)" +
|
") ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
if(true == recreate) {
|
sql.sqlMysqlExecute(sql_str01);
|
}
|
sql.sqlMysqlExecute(sql_str02);
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
|
}
|