📄 testsql.java
字号:
package test;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import beans.DailyRecord;
import beans.Dish;
import beans.Material;
import beans.MonthRecord;
import beans.User;
import com.mysql.jdbc.ResultSet;
import util.BaseSQL;
import util.DealMaterial;
public class TestSQL {
/**
* @param args
* @throws Exception
* @throws SQLException
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/* BaseSQL b = new BaseSQL();
try {
b.connect("eatery", "root", "123456");
java.sql.ResultSet rs = b.statement.executeQuery("select * from user");
rs.next();
String out = rs.getString(1) + rs.getString(2) + rs.getString(3);
System.out.println(out);
b.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
/* Hashtable my = new Hashtable();
my.put("yyf", "great");
String temp = (String)my.get("yyf");
temp = "greatest";
my.put("yyf", "greatest");
System.out.println(my.get("yyf"));
}*/
/* DealMaterial aa = new DealMaterial();
aa.getMaterial();
for(int i = 0 ; aa.hasMore(i);i++){
System.out.println(aa.getMaterial(i).getName()+" ID:"+aa.getMaterial(i).getMaterialID());
}*/
/* Dish temp = new Dish();
temp.getDetailInfo("1");
System.out.println(temp.queryMaterial("1"));*/
//---------------测试是float类型数值是否可比较
/* int j = 0;
for(int i = 0 ; i < 50 ; i++){
float m = Float.parseFloat("0.0");
if(m == 0){
j++;
}
}
System.out.println("j是:" + j);*/
//---------------------------测试结果,应该在较小的范围内不会有影响
//----------------------------测试Dish的addMaterial方法会不会产生重复
/* Dish temp = new Dish();
Material aa = new Material();
aa.setMaterialID("1");
aa.setName("asdf");
aa.setWeight(9);
temp.addMaterial(aa);
Material bb = new Material();
bb.setMaterialID("1");
bb.setName("asdf");
bb.setWeight(9);
temp.addMaterial(bb);
System.out.print("asdf");*/
//}
/* User aa = new User();
String bb = aa.getData("admin", "123456");
System.out.println(bb);*/
// Vector temp = new Vector();
// for(int i = 0 ; i < 10 ; i++){
// temp.add(new Dish());
// }
//
// Dish aa = (Dish)temp.get(5);
// aa.setDescription("sdafasdfasdf");
//
// System.out.println(((Dish)temp.get(5)).getDescription());
//----------------------删除用户------------------
// Material a = new Material();
// a.setMaterialID("00000025");
// a.getMaterialData("00000024");
// a.delete();
//------------------------测试日报表功能---------------
// DailyRecord aa = new DailyRecord();
// aa.setYear(2008);
// aa.setMonth(7);
// aa.setDay(15);
// aa.getDailyPeople();
//-----------------------------------测试单日主料使用情况--------------
// DailyRecord aa = new DailyRecord();
// aa.setYear(2008);
// aa.setMonth(7);
// aa.setDay(15);
// aa.getDetailMaterialUsed("猪肉");
// Hashtable h = aa.getH();
//----------------------------------测试主料使用-----------------------
// DailyRecord aa = new DailyRecord();
// aa.setYear(2008);
// aa.setMonth(7);
// aa.setDay(15);
// aa.getDailyBillMain();
// Hashtable h = aa.getH();
//-------------------------------测试月使用量-------------------
// MonthRecord aa =new MonthRecord();
// aa.
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -