Java Batch generation use case Script-use case script generation for reserved word keywords

Source: Internet
Author: User

20171012 New Patch Package program, the program organizes all the keywords and reserved words, support field a = "Field B" with field a = Field B, and do code refactoring. Keyword-specific testing of patch packs to verify keyword reserved words as libraries, tables, views, fields, dictionaries, etc.

Package Com.io.test;import Java.io.bufferedreader;import Java.io.bufferedwriter;import java.io.FileInputStream; Import Java.io.filenotfoundexception;import Java.io.fileoutputstream;import Java.io.inputstreamreader;import Java.io.OutputStreamWriter;PublicClassConstTest01 {PublicStaticvoidMain (string[] args) throws Exception {//TODO auto-generated Method Stub String path01 ="C:\\tmp\\const.txt"; String path02 ="C:\\tmp\\ksql.txt"; FileInputStream FIS =NewFileInputStream (PATH01); InputStreamReader ISR =NewInputStreamReader (FIS); BufferedReader br =NewBufferedReader (ISR); FileOutputStream fos =NewFileOutputStream (PATH02); OutputStreamWriter OSR =NewOutputStreamWriter (FOS); BufferedWriter BW =NewBufferedWriter (OSR); String temp; String Temp01;while ((Temp=br.readline ())! =Null) {if (Temp.contains ("\"")) {string[] arr = Temp.split ("\""); TEMP01 = arr[1]; Bw.write ("--<drop>"); Bw.newline (); temp ="drop table"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<create>"); Bw.newline (); temp ="CREATE TABLE"+temp01+"\npath \ ' c:\\tmp\\table\\"+temp01+"\ ' \nat temp \ n ("+temp01+"Integer (8) normal,test Integer (8) NORMAL) \ngo";//SYSTEM.OUT.PRINTLN (temp);Bw.write (temp); Bw.newline (); Bw.write ("--<insert>"); Bw.newline (); temp ="INSERT into"+temp01+"("+temp01+", test) \nvalues (0,12345678) \ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<select recordset=1-*>"); Bw.newline (); temp ="SELECT * FROM"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<update>"); Bw.newline (); temp ="Update"+temp01+"Set"+temp01+"= Test\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<select recordset=1-*>"); Bw.newline (); temp ="SELECT * FROM"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<update>"); Bw.newline (); temp ="Update"+temp01+"Set"+temp01+"= \ "Test\" \ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<select recordset=1-*>"); Bw.newline (); temp ="SELECT * FROM"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<drop>"); Bw.newline (); temp ="drop table"+temp01+"\ngo\n"; Bw.write (temp); Bw.newline (); Bw.write ("--<create>"); Bw.newline (); temp ="CREATE VIEW"+temp01+"As SELECT * from Sys_log_1\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<select recordset=1-*>"); Bw.newline (); temp ="SELECT * FROM"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<drop>"); Bw.newline (); temp ="DROP VIEW"+temp01+"\ngo\n"; Bw.write (temp); Bw.newline (); Bw.write ("--<create>"); Bw.newline (); temp ="CREATE DATABASE"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<drop>"); Bw.newline (); temp ="DROP DATABASE"+temp01+"\ngo\n"; Bw.write (temp); Bw.newline (); Bw.write ("--<drop>"); Bw.newline (); temp ="Drop Sortdict"+temp01+"\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<create>"); Bw.newline (); temp ="CREATE sortdict"+temp01+"\npath \ ' c:\\\\tmp\\\\table\\\\ ' \naliasname \ ""+temp01+"\ "\norder by Spell\nmaxwordlen 30\nsortvaluenum 1\ngo"; Bw.write (temp); Bw.newline (); Bw.write ("--<drop>"); Bw.newline (); temp ="Drop Sortdict"+temp01+"\ngo\n"; bw.write (temp); Bw.newline ();} Else if (Temp.contains ("//")) {Temp=temp.trim (). Replace ("//", "--- ---"); System. out. println (temp); Bw.write (temp); Bw.newline ();} // Bw.write (temp);  Bw.newline (); } bw.flush (); Bw.close (); }} 

Java Batch Generation use case Script-use case script generation for reserved word keywords

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.