| | |
| | | * @param recreate_tb
|
| | | */
|
| | | public static void createBTSGPRSState_Table(MysqlConnPool conn_pool, boolean recreate_tb) {
|
| | | String str1 = "DROP TABLE IF EXISTS "+Sql_Mysql.BTSGPRSState_Table; |
| | | String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSGPRSState_Table
|
| | | String sql_str1 = "DROP TABLE IF EXISTS "+Sql_Mysql.BTSGPRSState_Table; |
| | | String sql_str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSGPRSState_Table
|
| | | + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
| | | + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
| | | + "`op_cmd` INT NOT NULL DEFAULT 0, "
|
| | |
| | | Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
| | | try {
|
| | | if(true == recreate_tb) {
|
| | | sql.sqlMysqlExecute(str1); |
| | | sql.sqlMysqlExecute(sql_str1); |
| | | }else{
|
| | | //sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BTSGPRSState_Table);
|
| | | }
|
| | | sql.sqlMysqlExecute(str2);
|
| | | sql.sqlMysqlExecute(sql_str2); |
| | | String sql_str3 = " SELECT * FROM information_schema.columns "
|
| | | + " WHERE table_schema= 'db_ram_db' "
|
| | | + " AND table_name='tb_bts_gprs_state' "
|
| | | + " AND column_name='bts_task_inf'";
|
| | | //System.out.println(sql_str3);
|
| | | ResultSet rs = sql.sqlMysqlQuery(sql_str3);
|
| | | if(false == rs.next()) {
|
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BTSGPRSState_Table |
| | | + " ADD COLUMN `bts_task_inf` varchar(1024) NOT NULL DEFAULT ''");
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | |
| | |
|
| | | public static void main(String[] args) {
|
| | | MysqlConnPool conn_pool = new MysqlConnPool("123.207.82.239",3360,5);
|
| | | createBattParam_Table(conn_pool,false);
|
| | | createBTSGPRSState_Table(conn_pool,false);
|
| | | }
|
| | | }
|