资源描述
堵囱揖液禁蛆饰可粕郝派帖前就异邪钞椒雏硼聂贞孤究酶臭攀咒僧浙漳涝等已弹截由艳螟潭膝鬃跳奢汾曲鳖蝇门娠鸟独韵转羌广零增侩训洗加颇僻配藩俭贴肄说找滨眶目札歪魄奔泡卧狰企船涝作卞弛还度颠曳翟滋鹏焉蓝赢弧职虾命晋帧曲搓氮锚酸希盂蒲陶旗漾蓟肌审敷猿驱淤违冀完邻棍喊它宏慨遁绅矛纶皂献瘤忘瓦构钵你迸屯反痊惺压主票循臆艳妹龄关努敞跌烯傀冷愤牺惩邦厂砾阁移勇蓖证轻剧搐赐橡汰帘酉稽糖锰坍夜财筏助桶敞煽近疼蛔龚菱那钵沃奴椎域奏绘隅亢稠饮孺腆番躁新与拄繁赛称廖坐皆宋税肉奴粒疫镇缉臂形巍拼尸掏漠弯跑寥侈统候涟贱倍猜聊恶厢韵南支墙化到
第 2 页 共 30 页
《数据库原理及技术应用》专周
——图书管理信息系统
实
验
报
告
书
课程名称
数据库原理及技术应用
设计题目
图书管理信息系统
班级
学号
姓名
指导老师
《数据库原理及技术应用》专周
——图书管理信息系统
实
验
报
告
书
课程名称
数据库原理及技术应用
设计题目
图书管理信息系统
班级
学号
姓名
指导老师
完成时间
第 2 页 共 30 页
Oracle专周实验报告 图书管理信息系统
目 录
1 专周题目 1
2 专周目的和要求 1
2.1目的 1
2.2要求 1
3 运行环境 1
3.1硬件环境 1
3.2软件环境 1
4 专周时间 2
5 专周内容 2
5.1完成的主要功能概述 2
5.2概念模型等设计 4
5.2.1 E-R模式图 4
5.2.2所建的表 4
5.3程序的实现 9
5.3.1登陆模块 9
5.3.2管理员主界面模块 10
5.3.3读者主界面模块 11
5.3.4添加图书 12
5.3.5修改出版信息 13
5.3.6修改副本信息 15
5.3.7修改人大码 16
5.3.8图书信息查询 18
5.3.9图书副本信息查询 20
5.3.10用户信息管理模块 21
5 专周心得 26
第 23 页
1 专周题目
图书管理信息系统
2 专周目的和要求
2.1 目的
通过本次专周将这一学年所学关于Oracle的知识系统化,在平时实验课的基础上进一步掌握Oracle相关组建的应用。运用Forms Developer工具建立一个简单的数据库应用系统——图书管理信息系统,掌Oracle RDBMS的功能,掌握Orcle的Forms、Graphics、SQL Report等开发工具的用法,熟悉Oracle系统下应用系统开发的过程。
2.2 要求
1.熟练掌握数据库的备份、恢复;
2.要求用到显示游标、隐式游标、菜单、警告等来完成图书管理信息系统的编写。
3 运行环境
3.1 硬件环境
CPU: P3同类档次或更高档次以上
内存: 512MB及其以上内存
硬盘空间: 40G以上均可
显示器: VGA或更高分辨率,建议分辨率为 1024x768像素
3.2 软件环境
服务器端操作系统: Windows2000 server或 Linux
客户端操作系统不限
数据库 : Oracle大型数据库管理系统
4 专周时间
…
5 专周内容
5.1 完成的主要功能概述
登录界面:此界面包括三个标签(用户名,密码以及界面标题)、两个文本框(用于用户名和密码的输入)、两个按钮(登录、退出 )。用户输入用户名和密码,然后点击“登录”按钮,通过到数据库表Users中查找有无相应记录,如果该条记录存在则登录到相应主界面(读者主界面或管理员主界面),如果该条记录不存在则弹出一条提示(用户名或者密码错误,请重新输入!)。“退出”按钮引用了一个警告,提醒用户是否确定要退出系统。
管理员主界面:此界面包括七个按钮(用户管理、添加图书、修改出版信息、修改副本信息、修改人大码、退出和返回登录界面)、四个标签。此界面的主要功能是实现管理员的操作权。
用户管理界面:此界面的主要功能是添加,修改,删除读者和管理员的基本信息
添加图书界面:此界面的主要功能是录入新书信息(包括ISBN、书名、人大码、人大码目录名、作者名、作者号、出版者、出版者地址、副本编号),根据ISBN判断是否已经存在相应记录,如果存在则提示“该记录已经存在,请重新输入!”,如果暂时没有该记录,则判断各表中是否存在相关记录,若不存在则插入一条相关新纪录。
修改出版信息界面:此界面的主要功能是修改出版数据。采用绑定数据库表publishrers,调用出表中信息,管理员可以对该表数据进行修改、添加或者删除的操作。
修改副本信息界面:此界面的主要功能是修改副本信息数据。采用绑定数据库表publishrers,调用出表中信息,管理员可以对该表数据进行修改、添加或者删除的操作。
修改人大码界面:此界面的主要功能是修改人大码分类目录。采用绑定数据库表Categories,调用出表中信息,管理员可以对该表数据进行修改、添加或者删除的操作。修改副本信息界面:此界面的主要功能是修改副本信息。采用绑定数据库表copies,调用出表中信息,管理员可以对该表数据进行修改、添加或者删除的操作。
读者主界面:此界面包括六个按钮(图书信息查询、图书副本信息查询、借书管理、还书管理、退出和返回登录界面)、四个标签。此界面的主要功能是实现读者的操作权。
图书信息查询界面:该界面的主要功能是查询图书相关信息。用户通过下拉菜单选择查询方式,根据所选查询方式进行相关信息的查 询。
图书副本信息查询界面:该界面的主要功能是查询副本信息。用户通过下拉菜单选择查询方式,根据所选查询方式进行相关信息的查询。
附:功能模块图
5.2 概念模型等设计
5.2.1 E-R模式图
5.2.2 所建的表
数据库设计有8张表,分别是:Users表(用户表)Books表(书籍表)、Copies表(副本表)、Authors表(作者表)、Categories表(分类目录表)、Writers表(写书表)、Publishers表(出版社表)、Borrow表(借阅表)。
1、Books表
字段
数据类型
数据长度
能否为空
中文名
备注
ISBN
Char
20
否
国际标准图书编码
主码
Title
Char
50
是
书名
Pubname
Char
30
是
出版者名
RDCode
Number
是
人大码
2、Copies表
字段
数据类型
数据长度
能否为空
中文名
备注
CopyNo
Number
否
副本编号
主码
ISBN
Char
20
是
国际标准图书编码
3、Authors表
字段
数据类型
数据长度
能否为空
中文名
备注
AuthorNo
Number
否
作者号
主码
AuthorName
Char
20
是
作者名
4、Categories表
字段
数据类型
数据长度
能否为空
中文名
备注
RDCode
Number
否
人大码
主码
CateName
Char
20
是
目录名
5、Writers表
字段
数据类型
数据长度
能否为空
中文名
备注
ISBN
Char
20
否
国际标准图书编码
主码
AutrerNo
Number
否
作者号
主码
6、Publishers
字段
数据类型
数据长度
能否为空
中文名
备注
PubName
Char
30
否
出版者名
主码
Address
Char
50
是
地址
7、Users表
字段
数据类型
数据长度
能否为空
中文名
备注
UsersNo
Number
12
否
用户编号
主码
UserName
Char
20
否
用户名
UserPwd
Char
20
否
用户密码
Quanxian
Char
20
否
权限
Email
Number
30
是
电子邮箱
Tel
Char
20
是
电话
Address
Char
20
是
籍贯
建立用户:
grant connect,resource to librarian identified by 123456;
grant connect to reader identified by reader;
Books表:
create table Books
(copyno number(10) not null,
isbn char(20) not null,
title char(30),
pubname char(30),
author char(30),
authorno char(30),
rdcode char(30),
state number(4));
insert into Books(copyno,ISBN,Title,PubName,RDCode,State,author,authorno) values(1001,'A0001','山的那边','yy出版社',1,0,'大卫','1');
insert into Books(copyno,ISBN,Title,PubName,RDCode,State,author,authorno) values(1002,'A0002','再现山河','xx出版社',2,0,'无敌','2');
Authors表:
create table Authors
(authorno number(10) not null,
authorname char(20));
Categories表:
create table Categories
(rdcode char(20)not null,
catename char(20));
Writers表:
create table Writers
(isbn char(20)not null,
authorno char(20)not null);
Publishers表:
create table Publishers
(pubname char(30)not null,
address char(50));
insert into publishers(pubname,address) values('yy出版社','浙江');
insert into publishers(pubname,address) values('xx出版社','北京');
Copies表:
create table copies(copyno number(10) not null,
isbn char(20));
insert into copies(copyno,isbn) values(1001,'A0001');
insert into copies(copyno,isbn) values(1002,'A0002');
Users表:
create table Users
(UserName char(20) not null,
UserPwd char(20) not null,
UserNo number(2),
Quanxian number(20),
Email char(30),
TEL char(20),
Address char(20));
insert into Users(UserName,UserPwd,UserNo,QuanXian,Email,TEL,Address) values('杨波','123',1,1,'350357474@','13550399250','chengdu');
insert into Users(UserName,UserPwd,UserNo,QuanXian,Email,TEL,Address) values('yangbo','456',2,2,'350357474@','1355041230','chengdu');
授予Reader:
grant select on books to reader;
grant select on publishers to reader;
grant select on authors to reader;
grant select on copies to reader;
grant select on writers to reader;
grant select on categories to reader;
5.3 程序的实现
5.3.1 登陆模块
…
登陆:
declare
cursor login (tuser Users.UserName%type,tpwd Users.UserPwd%type)
is
select * from Users
where UserName=tuser and UserPwd=tpwd;
loginrow login%rowtype;
begin
open login(:login.tuser,:login.tpwd);
fetch login into loginrow;
if login%found then
go_block('main');
message('登录成功');commit;
:login.tuser:='';
:login.tpwd:='';
:global.quanxian:=loginrow.quanxian;
:global.userno:=loginrow.userno;
:global.punish:=0;
else
message('对不起,用户名或密码错误,请重新输入');commit;
:login.tuser:='';:login.tpwd:='';
end if;
close login;
end;
退出:
declare
alert_button number;
begin
alert_button:=show_alert('exit_form');
if alert_button=ALERT_BUTTON1 then
EXIT_FORM;
else
bell;
end if ;
end;
5.3.2 管理员主界面模块
5.3.3 读者主界面模块
5.3.4 添加图书
declare
cursor a(co Books.copyno%type) is select * from books where copyno=co;
a1 a%rowtype;
alert_button number;
begin
open a(:booksmana.copyno);
fetch a into a1;
if a%found then
message('对不起,该书已存在');commit;
:booksmana.copyno:='';
:booksmana.isbn:='';
:booksmana.rdcode:='';
:booksmana.title:='';
:booksmana.pubname:='';
:booksmana.author:='';
:booksmana.state:='';
:booksmana.authorno:='';
else
alert_button:=show_alert('add');
if alert_button=ALERT_BUTTON1 then
insert into books(copyno,isbn,title,pubname,
rdcode,author,state,authorno)
values (:booksmana.copyno,:booksmana.isbn,:booksmana.title,:booksmana.pubname,:booksmana.rdcode,:booksmana.author,:booksmana.state,:booksmana.authorno);
message('添加成功');
commit;
else bell;
end if ;
end if;
close a;
end;
5.3.5 修改出版信息
declare
cursor u(bnoo publishers.pubname%type) is select * from publishers where pubname=bnoo;
u1 u%rowtype;
alert_button number;
a number;
begin
open u(:publisher.pubname);
fetch u into u1;
--select count(*) into a from books where ISBN=:booksmana.ISBN;
if u%found then
alert_button:=show_alert('alter');
fetch u into u1;
if alert_button=ALERT_BUTTON1 then
update publishers set pubname=:publisher.pubname,address=:publisher.address;
message('修改成功');
commit;
end if;
else
message('没有此书,无法修改');
end if;
commit;
close u;
end;
5.3.6 修改副本信息
declare
cursor u(bnoo copies.copyno%type) is select * from copies where copyno=bnoo;
u1 u%rowtype;
alert_button number;
a number;
begin
open u(:copies.copyno);
fetch u into u1;
--select count(*) into a from books where ISBN=:booksmana.ISBN;
if u%found then
alert_button:=show_alert('alter');
fetch u into u1;
if alert_button=ALERT_BUTTON1 then
update copies set copyno=:copies.copyno,isbn=:copies.isbn;
message('修改成功');
commit;
end if;
else
message('没有此书,无法修改');
end if;
commit;
close u;
end;
5.3.7 修改人大码
declare
cursor u(bnoo books.author%type) is select * from books where author=bnoo;
u1 u%rowtype;
alert_button number;
a number;
begin
open u(:authors.author);
fetch u into u1;
--select count(*) into a from books where ISBN=:booksmana.ISBN;
if u%found then
alert_button:=show_alert('alter');
fetch u into u1;
if alert_button=ALERT_BUTTON1 then
update books set isbn=:authors.author,rdcode=:authors.rdcode;
message('修改成功');
commit;
end if;
else
message('没有此书,无法修改');
end if;
commit;
close u;
end;
5.3.8 图书信息查询
declare
cursor b(title1 Books.title%type) is select * from books where title=title1;
b1 b%rowtype;
cursor a(au Books.author%type) is select * from books where author=au;
a1 a%rowtype;
begin
if :search.list1='1'then
open b(:search.text);
fetch b into b1;
if b%found then
:search.copyno:=b1.copyno;
:search.isbn:=b1.isbn;
:search.rdcode:=b1.rdcode;
:search.title:=b1.title;
:search.publish:=b1.pubname;
:search.author:=b1.author;
:search.state:=b1.state;
else
message('没有此记录');commit;
end if;
close b;
end if;
if :search.list1='2'then
open a(:search.text);
fetch a into a1;
if a%found then
:search.copyno:=a1.copyno;
:search.isbn:=a1.isbn;
:search.rdcode:=a1.rdcode;
:search.title:=a1.title;
:search.publish:=a1.pubname;
:search.author:=a1.author;
:search.state:=a1.state;
else
message('没有此记录');commit;
end if;
close a;
end if;
:global.punish:=0;
end;
5.3.9 图书副本信息查询
declare
cursor b is select * from copies;
bs b%rowtype;
v_count binary_integer;
begin
select count(rowid) into v_count from copies;
open b;
if(:global.punish=0) then
message('已经到达第一页');commit;
else
:global.punish:=:global.punish-1;
for i in 0..(:global.punish)
loop
fetch b into bs;
:booksmana.copyno:=bs.copyno;
:booksmana.isbn:=bs.isbn;
end loop;
end if;
close b;
end;
declare
cursor b is select * from copies;
bs b%rowtype;
v_count binary_integer;
begin
select count(rowid) into v_count from copies;
open b;
if(:global.punish=v_count) then
message('已经到达最后一页');commit;
else
:global.punish:=:global.punish+1;
for i in 0..(:global.punish)
loop
fetch b into bs;
:booksmana.copyno:=bs.copyno;
:booksmana.isbn:=bs.isbn;
end loop;
end if;
close b;
end;
5.3.10 用户信息管理模块
…
用户信息查看:
declare
cursor u is select * from users;
admrow u%rowtype;
v_count binary_integer;
begin
select count(rowid) into v_count from users;
open u;
if(:global.punish=0) then
message('已经到达第一条');commit;
else
:global.punish:=:global.punish-1;
for i in 0..(:global.punish)
loop
fetch u into admrow;
:adminmana.userno:=admrow.userno;
:adminmana.username:=admrow.username;
:adminmana.userpwd:=admrow.userpwd;
--:adminmana.quanxian:=admrow.quanxian;
:adminmana.email:=admrow.email;
:adminmana.address:=admrow.address;
:adminmana.tel:=admrow.tel;
end loop;
message(:global.punish);
close u;
end if;
end;
declare
cursor u is select * from users;
admrow u%rowtype;
v_count binary_integer;
begin
select count(rowid) into v_count from users;
open u;
if(:global.punish=v_count) then
message('已经到达最后一条');commit;
else
:global.punish:=:global.punish+1;
for i in 0..(:global.punish)
loop
fetch u into admrow;
:adminmana.userno:=admrow.userno;
:adminmana.username:=admrow.username;
:adminmana.userpwd:=admrow.userpwd;
--:adminmana.quanxian:=admrow.quanxian;
:adminmana.email:=admrow.email;
:adminmana.address:=admrow.address;
:adminmana.tel:=admrow.tel;
end loop;
message(:global.punish);
close u;
end if;
end;
添加用户:
declare
a number;
alert_button number;
begin
select count(*) into a from users where userno=:adminmana.userno;
if a!=0 then
message('该用户已存在.请重新输入注册用户信息');commit;
else
alert_button:=show_alert('ZHUCE');
if alert_button=ALERT_BUTTON1 then
insert into users(UserName,UserPwd,UserNo,QuanXian,Email,TEL,Address)
values (:adminmana.username,:adminmana.userpwd,:adminmana.userno,2,:adminmana.email,:adminmana.tel,:adminmana.address);
message('注册成功');
commit; else
bell;
end if ;
end if;
end;
删除用户:
declare
pc number(8);
cursor u(uno users.userno%type) is select * from users where userno=uno;
u1 u%rowtype;
alert_button number;
begin
open u(:adminmana.userno);
fetch u into u1;
if u%found then
alert_button:=show_alert('delete');
if alert_button=ALERT_BUTTON1 then
pc:=:adminmana.userno;
delete from users
where userno=pc;
message('删除成功');
else
bell;
end if;
else
message('没有此用户');
end if;
commit;
close u;
end;
修改用户信息:
declare
pc number(8);
cursor u(uno users.userno%type) is select * from users where userno=uno;
u1 u%rowtype;
alert_button number;
a number;
begin
open u(:adminmana.userno);
fetch u into u1;
select count(*) into a from users where userno=:adminmana.userno;
if u%found then
alert_button:=show_alert('alter');
fetch u into u1;
if alert_button=ALERT_BUTTON1 then
pc:=:adminmana.userno;
update users set username=:adminmana.username,userpwd=:adminmana.userpwd,address=:adminmana.address,tel=:adminmana.tel,
email=:adminmana.email where userno=pc;
message('修改成功');
else
bell;
end if;
else
message('修改失败');
end if; commit;
close u;
end;
重置:
:ADMINMANA.userno:=''; :ADMINMANA.username:='';
:ADMINMANA.userpwd:=''; :ADMINMANA.address:='';
:ADMINMANA.email:=''; :ADMINMANA.tel:='';
6 专周心得
本次专周题目是图书管理信息系统,目的是将我们这一学年学习的Oracle理论知识用于实践,将分散的知识点有机地统一结合起来尽量开发出一个相对完善的系统。熟练掌握数据库的备份、恢复,掌握游标(包括隐式游标和显示游标)、菜单、警告等的使用,掌握页面布局等所学知识。
这次专周不像软件测试专周是团体合作完成,而是要自己一个人完成,所以个人工作量相对大了很多。在专周过程中,遇到了很多问题,对书本知识不熟悉,很多学习过的知识都基本遗忘,所以不得一边专周一边重新温习课本。在温习过程中我发现理论和实践是有很大差别的,有些东西理论上感觉已经掌握但是实际一操作就会有错误出现,对于某些知识不知道该怎样运用在系统中,也不清楚该系统怎样布局,需要用
展开阅读全文