从MYSQL到oracle的迁移以及备份(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-03-23 22:31 点击:次
// String bb=full_to_part(aa);
// System.out.println(bb);
}
/**
* 将整体的导出的mysql脚本,拆分为建库建表和插入数据的脚本
* 将其中的批量插入数据语句转换为每条插入数据语句的脚本
* @param full_sql_path 原始全部导出的mysql脚本
* @param create_sql_path 拆出来的建库建表的脚本
* @param insert_sql_path 拆出来的插入数据脚本
* @throws IOException
*/
private static void readFull_to_insert(String full_sql_path,String create_sql_path,String insert_sql_path) throws IOException{
File fullFile=new File(full_sql_path);
File createFile=new File(create_sql_path);
if(!createFile.exists())
createFile.createNewFile();
File insertFile=new File(insert_sql_path);
if(!insertFile.exists())
insertFile.createNewFile();
InputStreamReader isr=new InputStreamReader(new FileInputStream(fullFile), "UTF-8");
BufferedReader br=new BufferedReader(isr);
OutputStreamWriter osw_create=new OutputStreamWriter(new FileOutputStream(createFile), "UTF-8");
OutputStreamWriter osw_insert=new OutputStreamWriter(new FileOutputStream(insertFile), "UTF-8");
BufferedWriter bw_create=new BufferedWriter(osw_create);
BufferedWriter bw_insert=new BufferedWriter(osw_insert);
Map<Integer, String> allData=new HashMap<Integer,String>();
String line=null;
int num=17;
while((line=br.readLine())!=null){
String lowerLine=line.toLowerCase();
if(lowerLine.startsWith("insert")){ //在该语句下用来判断插入数据的先后顺序
if(lowerLine.indexOf("`sequenceblock`")!=-1){
allData.put(1, line);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>