资源简介
SSD7所有答案SSD7所有答案SSD7所有答案SSD7所有答案
代码片段和文件信息
package library;
import java.util.*;
import java.sql.*;
import java.text.*;
/**
* class Library represents the functionality of a library
*
* @author iCarnegie
* @version 1.0
*/
public class Library {
// singleton DBWrapper
private DBWrapper myConnection = null;
/**
* class Library constructor
*/
public Library() throws Exception {
myConnection = DBWrapper.Instance();
}
/**
* holdBook places a hold on book with given call number for the given
* member
*
* @param callNumber
* String call number of book to hold
* @param member
* Member member who wishes to hold the book.
* @return boolean
*/
public boolean holdBook(String callNumber Member member) throws Exception {
String sqlQuery = “select count(*) as counted from hold where callnumber=‘“
+ callNumber + “‘ and ssn=‘“ + member.getSSN() + “‘“;
boolean alreadyHeld = false;
ResultSet r = null;
// Select the count of the books. If it is 1 this book is already held.
r = myConnection.runQuery(sqlQuery);
if (r.next()) {
if (r.getInt(“counted“) == 1) {
alreadyHeld = true;
}
}
// if alreadyHeld is true then don‘t place a hold. Place a hold
// otherwise.
if (alreadyHeld) {
return true;
} else {
sqlQuery = “INSERT INTO Hold VALUES (“ + member.getSSN() + “ ‘“
+ callNumber + “‘ CURRENT_TIMESTAMP)“;
if (myConnection.runUpdate(sqlQuery) > 0)
return true;
else
return false;
}
}
/**
* checkinBook checks the book with the specified book id into the library.
*
* @param bookId
* int id of book to check in
* @return boolean
*/
public boolean checkInBook(int bookId) throws Exception {
// Build the sql query.
String sqlQuery = “UPDATE Book SET borrowerssn = null librarianssn = null duedate = null WHERE BookID = “
+ bookId;
// Run the update.
if (myConnection.runUpdate(sqlQuery) > 0)
return true;
else
return false;
}
/**
* approve a check out for book with given book id for a member with given
* member ssn
*
* @param bookId
* int id of book to check out
* @param memberSSN
* int ssn of member who wants to check book out
* @return boolean
*/
private boolean approveCheckout(int bookId int memberSSN) throws Exception {
boolean canCheckOut = true;
// check to see if that book is already checked out
boolean checkedOut = LibraryBook.isCheckedOut(bookId);
if (checkedOut) {
canCheckOut = false;
} else {
// see if another member has higher priority on this book
// We have to check the holds if the number of
// holds on this title exceeds the number of
// available copies.
String callNumber = LibraryBook.getBook(bookId).getCallNumber();
int availabl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1121 2009-11-13 16:49 SSD7所有练习答案\exam1.sql
文件 2597 2007-07-07 10:15 SSD7所有练习答案\exam3\exam3.txt
文件 2673 2010-10-30 11:08 SSD7所有练习答案\Exercise 1\BookPublisher.html
文件 1540 2010-10-16 10:21 SSD7所有练习答案\Exercise 1\Create.sql
文件 479 2010-10-16 10:43 SSD7所有练习答案\Exercise 1\part3.txt
文件 726 2010-10-16 10:31 SSD7所有练习答案\Exercise 1\Rel-ops.txt
文件 4167 2009-12-29 10:34 SSD7所有练习答案\Exercise10\ssd7-ex10-65.rar
文件 1769 2009-10-27 15:38 SSD7所有练习答案\Exercise2\exercise2.sql
文件 2050 2009-11-06 16:30 SSD7所有练习答案\Exercise3\alter_tables.sql
文件 86 2009-11-06 14:41 SSD7所有练习答案\Exercise3\delete_rows.sql
文件 2835 2009-11-07 11:40 SSD7所有练习答案\Exercise3\queries.sql
文件 188363 2009-07-15 23:42 SSD7所有练习答案\Exercise4\Html_Pages.zip
文件 10263 2009-07-15 23:41 SSD7所有练习答案\Exercise4\Library.java
文件 3761 2009-07-15 23:41 SSD7所有练习答案\Exercise4\MemberRegisterController.java
文件 3674 2009-07-15 23:41 SSD7所有练习答案\Exercise4\newmember.jsp
文件 3360 2009-07-15 23:41 SSD7所有练习答案\Exercise4\web.xm
文件 1215 2009-05-25 00:00 SSD7所有练习答案\exercise5\entityattributes.txt
文件 22276 2009-12-08 14:33 SSD7所有练习答案\exercise5\ER.gif
文件 1329 2009-12-08 14:32 SSD7所有练习答案\exercise5\ER.txt
文件 38596 2009-05-21 00:00 SSD7所有练习答案\exercise5\Ex5erd.jpg
文件 2136 2009-12-04 16:04 SSD7所有练习答案\Exercise6\normalization.txt
文件 2584 2009-12-08 17:01 SSD7所有练习答案\Exercise7\relational-model.sql
文件 3263 2009-12-08 16:47 SSD7所有练习答案\Exercise7\relational-schema.txt
文件 6144 2009-12-08 14:12 SSD7所有练习答案\Exercise7\ssd7-ex7.rar
文件 4591 2008-07-17 18:39 SSD7所有练习答案\Exercise9\application.txt
文件 1586 2009-12-26 09:55 SSD7所有练习答案\Exercise9\deadlock(Window 1).txt
文件 1118 2009-12-26 09:55 SSD7所有练习答案\Exercise9\deadlock(Window 2).txt
文件 2772 2009-12-29 09:51 SSD7所有练习答案\Exercise9\deadlock.txt
文件 4591 2008-07-17 18:39 SSD7所有练习答案\Exercise9\Ex9_ssd7\application.txt
文件 1987 2008-07-17 18:39 SSD7所有练习答案\Exercise9\Ex9_ssd7\deadlock.txt
............此处省略30个文件信息
评论
共有 条评论