蓄电池监控管理平台数据库初始化程序
2018-09-10 44ea724402c5a1b55d50a6dff2fe7f55b346fe5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.dev.fbs9100;
 
import java.sql.SQLException;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
 
public class FBS9100S_DFU_SQL {
    /***************************************************************************/
    public static final int DFU_STATE_NULL = 0;
    public static final int DFU_STATE_WRITE = 1;
    public static final int DFU_STATE_READ = 2;
    public static final int DFU_STATE_CHECK_OK = 3;
    /***************************************************************************/
    /**
     * ´´½¨ tb_fbs9100s_dfu ±í²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
     * @param con_pool
     * @param al_param
     */
    public static void createFBS9100S_DFU_TableOnRam(MysqlConnPool con_pool)
    {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100S_DFUState_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100S_DFUState_Table
                    + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                    + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                    + "`sysVersion_new` INT NOT NULL DEFAULT 0, "
                    + "`softVersion_new` INT NOT NULL DEFAULT 0, "
                    + "`sysVersion_dev` INT NOT NULL DEFAULT 0, "
                    + "`softVersion_dev` INT NOT NULL DEFAULT 0, "
                    + "`dfu_file` varchar(200) NOT NULL DEFAULT '  ', "
                    + "`dfu_en` BOOLEAN NOT NULL DEFAULT false, "
                    + "`dfu_wr_stat` INT NOT NULL DEFAULT 0, "
                    + "`dfu_data_blocknum` INT NOT NULL DEFAULT 0, "
                    + "`dfu_data_blocklen` INT NOT NULL DEFAULT 256, "
                    + "`dfu_password` varchar(100) NOT NULL DEFAULT '  ', "
                    + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                    + " PRIMARY KEY (`num`) ) "
                    + " ENGINE=MEMORY DEFAULT CHARSET=utf8";
        
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        try {
            sql.sqlMysqlExecute(str1);
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
}