package com.sql.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_Dis_Batt {
|
public static void init(MysqlConnPool pool) {
|
System.out.println("Db_Dis_Batt init Start " + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms));
|
|
createDb_Dis_Batt(pool);
|
|
createBatt_Test_Inf_Table(pool);
|
|
|
System.out.println("Db_Dis_Batt init End " + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms));
|
}
|
|
public static void createBatt_Test_Inf_Table(MysqlConnPool pool)
|
{
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.Batt_Test_Inf_Table + "_auto" +
|
" INCREMENT 1" +
|
" MINVALUE 1" +
|
" MAXVALUE 9223372036854775807" +
|
" START 1" +
|
" CACHE 1;";
|
//´´½¨×ÔÔöÐòÁÐ
|
sql.sqlMysqlExecute(sql_str_auto);
|
|
String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Batt_Test_Inf_Table + " "
|
+ "(num integer NOT NULL DEFAULT nextval('" + Sql_Mysql.Batt_Test_Inf_Table + "_auto'::regclass)," +
|
" binf_id integer NOT NULL," +
|
" test_record_count integer NOT NULL," +
|
" test_record_count_ex integer NOT NULL," +
|
" record_time timestamp without time zone NOT NULL," +
|
" test_starttime timestamp without time zone NOT NULL," +
|
" test_type integer NOT NULL DEFAULT 0," +
|
" record_num integer NOT NULL DEFAULT 0," +
|
" test_starttype integer NOT NULL DEFAULT 0," +
|
" test_timelong integer NOT NULL DEFAULT 0," +
|
" test_stoptype integer NOT NULL DEFAULT 0," +
|
" group_vol double precision NOT NULL DEFAULT '0'::double precision," +
|
" test_curr double precision NOT NULL DEFAULT '0'::double precision," +
|
" test_cap double precision NOT NULL DEFAULT '0'::double precision," +
|
" max_monnum integer NOT NULL DEFAULT 0," +
|
" max_monvol double precision NOT NULL DEFAULT '0'::double precision," +
|
" min_monnum integer NOT NULL DEFAULT 0," +
|
" min_monvol double precision NOT NULL DEFAULT '0'::double precision," +
|
" PRIMARY KEY (num)" +
|
")";
|
sql.sqlMysqlExecute(sql_str);
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Batt_Test_Inf_Table + " OWNER TO sysdba;");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".binf_id IS 'µç³Ø×éid';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_record_count IS 'µÚN´Î·Åµç';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".record_time IS '¼Ç¼ʱ¼ä';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_starttime IS '²âÊÔ¿ªÊ¼Ê±¼ä';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_type IS '²âÊÔÀàÐÍ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".record_num IS '¼Ç¼×ÜÊý';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_starttype IS '²âÊÔ¿ªÊ¼ÀàÐÍ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_timelong IS '²âÊÔʱ³¤';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_stoptype IS '²âÊÔÍ£Ö¹ÀàÐÍ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_curr IS '²âÊÔµçÁ÷';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".test_cap IS '²âÊÔÈÝÁ¿';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".max_monnum IS '×î´óµ¥Ìåµçѹ±àºÅ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".max_monvol IS '×î´óµ¥Ìåµçѹ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".min_monnum IS '×îСµ¥Ìåµçѹ±àºÅ';");
|
sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Batt_Test_Inf_Table + ".min_monvol IS '×îСµ¥Ìåµçѹ';");
|
} catch (Exception e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
public static void createDb_Dis_Batt(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute("CREATE SCHEMA IF NOT EXISTS " + Sql_Mysql.DB_DIS_BATT + " AUTHORIZATION sysdba");
|
} catch (SQLException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|