?? sql.java
字號:
import java.io.*;
public class SQL {
public SQL() {
}
public static void main(String[] args) throws Exception{
Interpreter interpreter = new Interpreter("quit;");
Catalog catalog = new Catalog();
BufferManager buffer = new BufferManager();
IndexManager index = new IndexManager(buffer);
RecordManager record = new RecordManager(buffer, index);
API api = new API(index, record, catalog);
String command = new String("");
System.out.print("SQL>");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String com= br.readLine();
while(com!=null){
int pos=0;
while(com!=null){
pos = com.indexOf(";");
if(pos>=0){
command = command+"\n"+com.substring(0,pos+1);
interpreter.init(command);
if(catalog.test(interpreter)){
if(api.exec(interpreter))
System.out.println("execute successfully");
else{
System.out.println("execute failed");
}
}
else{
if(interpreter.mean == 0)
;
else
System.out.println("出錯啦,請確保各屬性和表名正確");
}
System.out.print("SQL>");
if(pos!=com.length()-1){
command = com.substring(pos,com.length());
}
else
command = new String("");
break;
}
System.out.print("SQL>");
command = command + "\n"+com;
com = br.readLine();
}
com = br.readLine();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -