storebooktitle.java

来自「这是一个小程序 网上书店用的 我们学生做的一个小实验」· Java 代码 · 共 44 行

JAVA
44
字号
package bean;
import java.util.*;
import java.io.*;
import java.sql.*;

/** 
 * class StoreBook is a heavy weight representation
 * of a book at a library
 */
public class StoreBookTitle
{
    /**
     * class StoreBook constructor
     */
    public StoreBookTitle()
    {}
    
    /**
     * getBook returns a book object with the specified id
     * @param inBookId int id of book
     * @return Book
     */
    public static BookTitle getBookTitle( String inBookId ) 
	throws Exception {
	
	BookTitle myBook = null;
	String sqlQuery = "select * from booktitle where B_ISBN='" + inBookId + "'";
	// Get a the singleton db wrapper
	DBWrapper myConnection = DBWrapper.Instance();
        ResultSet r = null;
	
	r = myConnection.runQuery( sqlQuery );
	if (r.next()) {
	    // create the book object
	    myBook=new BookTitle( r.getString( "B_Title" ), r.getString( "B_Author" ),
				  r.getString( "B_ISBN" ), r.getString( "B_Edition" ),r.getString("Pub_num"),r.getString("B_DatePublished"), 
				  r.getDouble( "B_Price" ), r.getDouble( "B_discont" ),r.getString("B_Description"),r.getInt("B_qutlnStore"),
				  r.getString( "Categ_num" ));
	}
	// close the result set
	r.close();
	return myBook;
    }
}

⌨️ 快捷键说明

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