⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbmanager.java

📁 JAVA编写的单击的PIZZA店销售系统
💻 JAVA
字号:
package Dbprocess;
import java.sql.*;
import OrderInf.*;
import PizzaProduct.*;
import Storage.*;
public class DBmanager {
	ResultSet resultSet;
	Connection con;
	public DBmanager(){
		
			try{
				Class.forName("org.gjt.mm.mysql.Driver"); 
				con=DriverManager.getConnection("jdbc:mysql://localhost/Pizza?user=root&password=198652");
			}
			catch (ClassNotFoundException e1) {
				System.out.println(e1.toString());
	       	}
			catch (SQLException e2) {
				System.out.println(e2.toString());
			}
	}
	/**
	 * Some useful function
	 */
	/*public void DBtoTable(Table atable,String adbtable){
		selectDB(adbtable);
		TableItem[] tableitem = new TableItem[50];
		int cc = atable.getColumnCount();
		int i=0;
		int j;
		 while (resultSet.next()) {
				tableitem[i] = new TableItem(atable, SWT.BORDER);
				for(j=0;j<cc;j++){
					tableitem[i].setText(j,resultSet.getString(j));
				}
      	}
	}*/

	
	/**
	 * some sql statement
	 * 
	 */
	public void updateDB(String atable,String aname,int quan,boolean addition){
		UpdateDB udb = new UpdateDB(atable,aname,quan,addition,con);
	}
	public void updateDBpiz(Pizza[] pizzas){
		UpdateDB udb = new UpdateDB(pizzas,con);
	}
	
	public void selectDB(String atable){
		SelectDB sdb = new SelectDB(atable);
		resultSet =sdb.getResultSet();
	}
	public void insertDB(PizzaOrders po){
		InsertDB idb = new InsertDB(po,con);
	}
	public void insertDB(String saleid,String staffid){
		InsertDB idb = new InsertDB(saleid,staffid,con);
	}
	public void updateDB(StorageItem storage){
		UpdateDB udb = new UpdateDB(storage,con);
	}

	public Connection getCon() {
		return con;
	}
	public void close(){
		try{
		con.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -