资源简介
全部QUIZ+EXERCISE1-10+EXAM1-3

代码片段和文件信息
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个文件信息
- 上一篇:基于遗传算法的机组组合
- 下一篇:擂台法则构建Pareto
相关资源
- 数据库系统基础教程答案第三版机械
- 软考数据库系统工程师复习资料(完
- MoNyog8.5+破解补丁
- ANSYS LS-DYNA
- 全国4级地址库,京东数据
- 一个超简单的企业管理系统(带ACCE
- 数据库课设:图书管理系统报告
- 合同管理系统的源代码(附数据库)
- ado数据库MFC图书管理系统vs2010
- 数据库VFP课程设计
- 数据库实现学生成绩管理系统选课管
- 排队机叫号 源代码
- Access数据库在线编辑器
- Php 导出数据为EXCEL程序
- 人大金仓数据库系统表
- 模拟ATM柜员机系统--连接数据库
- 用工厂模式开发多数据库连接类
- 图片存储到数据库保存二进制文件并
- 数据库水印嵌入提取数据库水印数据
- 数据库课程设计以及指导思想
- 加班网上管理 单位
- 数据库课程设计报告(关于房地产销
- 数据库课程设计(改改直接交)
-
将数据库的表生成xm
l文件 - Ajax定时读取数据库(源代码发布)
- 浪潮数据库结构
- 数据库查询优化算法
- PB做的俄罗斯方块
- 典当综合业务管理系统(完整版)
- 标准化题库考试系统
评论
共有 条评论