蓄电池监控管理平台数据库初始化程序
LiJun
2018-11-29 89e2b84a38d1c3ab19933a41c3a409be31c8ed5a
tb_fbs9100s_dfu_state表中添加文件长度列
6个文件已修改
142 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/dev/fbs9100/FBS9100S_DFU_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100S_DFU_SQL.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class
Binary files differ
BattMonitor_DB_Builder/bin/com/dev/fbs9100/FBS9100S_DFU_SQL.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class
Binary files differ
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java
@@ -394,7 +394,7 @@
    }
    public static void main(String[] args) {
        MysqlConnPool conn_pool = new MysqlConnPool("123.207.82.239",3360,5);
        MysqlConnPool conn_pool = new MysqlConnPool("127.0.0.1",3360,5);
        createBTSGPRSState_Table(conn_pool,false);
    }
}
BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100S_DFU_SQL.java
@@ -1,50 +1,69 @@
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();
        }
    }
}
package com.dev.fbs9100;
import java.sql.ResultSet;
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 '  ', "
                    + "`dfu_file_len` INT NOT NULL DEFAULT 0,"
                    + " 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);
            String sql_str3 = " SELECT * FROM information_schema.columns  "
                            + " WHERE table_schema= 'db_ram_db' "
                            + " AND table_name='tb_fbs9100s_DFU_state' "
                            + " AND column_name='dfu_file_len'";
            //System.out.println(sql_str3);
            ResultSet rs = sql.sqlMysqlQuery(sql_str3);
            if(false == rs.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100S_DFUState_Table
                                + " ADD COLUMN dfu_file_len int not null DEFAULT 0" +
                                "");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    public static void main(String[] args) {
        MysqlConnPool conn_pool = new MysqlConnPool("127.0.0.1",3360,5);
        createFBS9100S_DFU_TableOnRam(conn_pool);
    }
}
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -563,6 +563,7 @@
                        }
                        
                //---------------------------------------------------------------------------------------------//
                //-------------------------------- 2018-10-16 by lijun   (  binf表中添加   station_install->标识机房是否已经安装 )------------------------------------//        
                        res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
                                + " WHERE table_schema='db_battinf'"
@@ -574,7 +575,25 @@
                        }
                        
                //---------------------------------------------------------------------------------------------//
                //-------------------------------- 2018-11-29 by lijun   (  binf表中添加   StationId_ex->基站站址编号   install_user-->安装人)------------------------------------//
                        res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
                                + " WHERE table_schema='db_battinf'"
                                + " AND table_name='tb_battinf'"
                                + " AND column_name='StationId_ex'");
                        if(false == res.next()) {
                            sqlMysqlExecute("ALTER TABLE " + BattInf_Table
                                            + " ADD COLUMN `StationId_ex` varchar(20) DEFAULT '' AFTER StationId");
                        }
                        res = sqlMysqlQuery("SELECT * FROM information_schema.columns"
                                + " WHERE table_schema='db_battinf'"
                                + " AND table_name='tb_battinf'"
                                + " AND column_name='install_user'");
                        if(false == res.next()) {
                            sqlMysqlExecute("ALTER TABLE " + BattInf_Table
                                    + " ADD COLUMN `install_user` varchar(64) DEFAULT ''");
                        }
                //---------------------------------------------------------------------------------------------//
                        
                        
        //---------------------------------------------------------------------------------------------//