20171012新补丁包程序,程序整理了全部的关键字和保留字,支持 字段a = "字段b" 与 字段a = 字段b,并做了代码重构。对补丁包进行关键字专项测试,验证关键字保留字作为库、表、视图、字段、词典等情况
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;
public class ConstTest01 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String path01 = "C:\\tmp\\const.txt";
String path02 = "C:\\tmp\\ksql.txt";
FileInputStream fis = new FileInputStream(path01);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
FileOutputStream fos = new FileOutputStream(path02);
OutputStreamWriter osr = new OutputStreamWriter(fos);
BufferedWriter bw = new BufferedWriter(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