| | |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.TB_Interface_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.TB_Interface_Table+ " (" + |
| | | " `num` int(11) NOT NULL AUTO_INCREMENT," + |
| | | " `interface_number` varchar(255) NOT NULL DEFAULT ''," + |
| | | " `interface_number` varchar(1024) NOT NULL DEFAULT ''," + |
| | | " `interface_name` varchar(255) NOT NULL DEFAULT ''," + |
| | | " `enable`int NOT NULL DEFAULT '1'," + |
| | | " PRIMARY KEY (`num`) " + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //修改字段env_temp 类型为float |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='web_site'" |
| | | + " AND table_name='tb_interface'" |
| | | + " AND column_name='interface_number' AND CHARACTER_MAXIMUM_LENGTH != '1024'"); |
| | | if(res.next()){ |
| | | //修改字段env_temp 类型为float |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.TB_Interface_Table |
| | | + " CHANGE `interface_number` `interface_number` varchar(1024) NOT NULL DEFAULT '';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |