📄 db.java
字号:
package com.yijia_ctgu.DB;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.io.IOException;
import java.util.Properties;
import com.yijia_ctgu.exception.NotQueryException;
/**
*
* @author yijia
*
*/
public class DB {
public static Table getTable(String tableName) throws NotQueryException{
Properties prop = new Properties();
try {
prop.load(Config.class.getResourceAsStream("config.properties"));
} catch (IOException e) {
System.out.println("File:config.properties no find,PLS check out!");
e.printStackTrace();
}
String mainPropertyName=prop.getProperty(tableName);
if(mainPropertyName!=null)
return new Table(tableName,mainPropertyName);
else {
System.out.println("the table "+tableName+" doesn't exist");
throw new NotQueryException();
}
}
public static void main(String []dsf){
try {
System.out.println(DB.getTable("user"));
} catch (NotQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -