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

📄 bookstore.java

📁 这是一个小程序 网上书店用的 我们学生做的一个小实验
💻 JAVA
字号:
package bean;
import java.sql.ResultSet;
import java.text.*;

/**
 * class Library represents the functionality of a library
 *
 * @author CTE
 * @version 1.0
 */
public class Bookstore
{
    // singleton DBWrapper
    private DBWrapper myConnection = null;
    
    /**
     * class Library constructor
     */
    public Bookstore() 
	throws Exception {
	
	myConnection = DBWrapper.Instance();
    }
    /**
     * validateCustomer returns a customer object for the customer with the given ssn and password
     * @param ssn String id of customer
     * @param passWord String password of customer
     * @return Customer
     */
    public Customer validateCustomer( String ssn, String passWord ) 
	throws Exception {
	
	String sql = "SELECT * FROM customer WHERE num = " + ssn +
	    " AND passwd = '" + passWord + "'";
	
	ResultSet r = myConnection.runQuery(sql);
	if (r==null) {
	    return null;
	}
	if (r.next()) {
	    return StoreCustomer.getCustomer(r.getString("num"));
	} else {
	    return null;
	}
    }
}   

⌨️ 快捷键说明

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