freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于中間件的圖書管理系統(tǒng)unix課程設(shè)計(jì)-文庫吧

2025-06-12 18:48 本頁面


【正文】 常用參數(shù)有:?, help: 幫助D, database=DB_name: 指定數(shù)據(jù)庫h, host=Host_name: 指定主機(jī)u, user=DB_user_name: 指定用戶p[…], password[=…]: 指定密碼 客戶端命令行 命令行提示符下輸入:mysql 或 mysql –u root進(jìn)入mysql系統(tǒng)。提示符為“”,可以使用的命令有:show databases / tables。use database。create database db。create table tbl。drop database db/ table tbl。select … from tbl … where …insert … into tbl … values … update … tbl … set … where …delete … from tbl … where … MySQL開發(fā)接口不同版本的MySql有不同的目錄設(shè)置?!纛^文件:目錄:/usr/include/mysql使用:include mysql/說明:必要時(shí)可使用I參數(shù)◆庫文件:靜態(tài)庫:/usr/lib/mysql/動態(tài)庫:/usr/lib/mysql/使用參數(shù):L/usr/lib/mysql lmysqlclient◆初始化數(shù)據(jù)結(jié)構(gòu)mysql_init(amp。mysql)?!暨B接數(shù)據(jù)庫mysql_real_connect(amp。mysql,localhost,root,0,“mydb,0,NULL,0)?!魣?zhí)行查詢語句mysql_querymysql_query(amp。mysql,SELECT * FROM person)。//保存結(jié)果result=mysql_store_result(amp。mysql)?!籼幚斫Y(jié)果集while((row=mysql_fetch_row(result))){ fprintf(stdout,%s|\t%s\n,row[0],row[2])。 }mysql_free_result(result)。 //清理數(shù)據(jù) mysql_close(amp。mysql)。 //關(guān)閉連接}◆編譯和鏈接方法編譯鏈接時(shí)要使用L和l參數(shù)例如:cc o mysql L/usr/lib/mysql lmysqlclient五、調(diào)試與測試1) 安裝組件:rpm – ivh mysqldevel*.rpm2) 增加服務(wù):vi /etc/services S1 1245/tcp S2 1246/tcp3) 連接數(shù)據(jù)庫:mysql –u root4) 運(yùn)行服務(wù)器:cc o server L/usr/lib/mysql lmysqlclient ./server s15) 運(yùn)行中間件:cc –o middle ./middle s2 s1 localhost6) 運(yùn)行客戶端:cc –o client ./client s2 localhost1)MySQL數(shù)據(jù)庫的相關(guān)截圖,在文件中編寫創(chuàng)建數(shù)據(jù)庫library,在該數(shù)據(jù)庫下創(chuàng)建admi、books、borrow、test表,并插入相應(yīng)的數(shù)據(jù),具體內(nèi)容如下圖所示。① 數(shù)據(jù)庫library,:圖 ② 數(shù)據(jù)庫library中的相關(guān)表,:圖 ③ 數(shù)據(jù)庫library中部分表的內(nèi)容,:圖 2)::圖 3),:圖 4),:圖 5)實(shí)現(xiàn)查詢圖書功能,:6)實(shí)現(xiàn)用戶登錄功能,且實(shí)現(xiàn)了密碼不回顯功能,:圖 7)實(shí)現(xiàn)用戶查詢圖書功能,: 圖 8)實(shí)現(xiàn)用戶借書功能,:9)實(shí)現(xiàn)用戶還書功能,:圖 10)實(shí)現(xiàn)用戶續(xù)借功能,:圖 11)實(shí)現(xiàn)用戶注銷,:12)實(shí)現(xiàn)管理員登錄,且實(shí)現(xiàn)了密碼不回顯功能功能,:圖 13)實(shí)現(xiàn)管理員查詢圖書功能,:圖 14)實(shí)現(xiàn)管理員增加圖書功能,:圖 15)實(shí)現(xiàn)管理員刪除圖書功能,:圖 刪除圖書book10后再查詢改圖書,提示“未找到該圖書”,說明確實(shí)刪除成功,:16)實(shí)現(xiàn)管理員注銷功能,:圖 17)退出系統(tǒng),:六、設(shè)計(jì)中遇到的問題及解決方法這是我們第一次學(xué)習(xí)關(guān)于中間件的知識,對它的具體運(yùn)行只是有一定程度的了解,不是很深刻,在設(shè)計(jì)中由于對UNIX知識的掌握不好,導(dǎo)致初期進(jìn)度是相當(dāng)?shù)穆?,在開始的幾天里差不多就沒有什么進(jìn)度,后來通過我們小組成員的討論、不斷查閱資料及向老師請教,我們開始有了一點(diǎn)點(diǎn)的設(shè)計(jì)思路,設(shè)計(jì)過程中用到的知識不單單是課本上有的,還有的是課本上沒介紹過的,因此這就需要我們多方的查閱資料和向老師請教。平時(shí)我們都習(xí)慣了使用Windows的編輯器,開始的時(shí)候由于UNIX的文檔編輯和Windows有著很大的區(qū)別,UNIX是全字符編輯器,所以在初期使用UNIX進(jìn)行的編輯的時(shí)候有點(diǎn)不知道該從那下手,后來經(jīng)過學(xué)習(xí)知道在其編輯過程中我們可以使用終端通過命令來實(shí)現(xiàn)。還有在數(shù)據(jù)庫的建立中,由于其基本程序中不帶有數(shù)據(jù)庫,一次我們必須自己建立一個數(shù)據(jù)庫來存儲信息,但是我們不知道怎樣在客戶端和主機(jī)程序中插入數(shù)據(jù)庫,以此來存儲圖書信息,在指導(dǎo)老師和同學(xué)的幫助下,還有借助網(wǎng)絡(luò)查了一些資料后終于解決了這一問題,等等。在編寫好程序后,發(fā)現(xiàn)在管理員增加圖書模塊,只能連續(xù)的增加圖書,不能退出該選項(xiàng)。在仔細(xì)研究代碼后,我在管理員增加圖書的代碼后添加了break語句,成功的解決了錯誤。其次原先若輸入比菜單中選項(xiàng)大的數(shù)字,系統(tǒng)沒有識別錯誤,繼續(xù)執(zhí)行。為了解決這個錯誤,我在客戶端的主菜單部分添加了ifelse語句,對字符進(jìn)行判斷和錯誤處理,成功的解決了該錯誤。其實(shí)設(shè)計(jì)中遇到的問題遠(yuǎn)比這多很多,因?yàn)檎莆罩R的程度不同,各種各樣的編程問題都會遇到,我們堅(jiān)持不懈,通過不斷的學(xué)習(xí)和查閱資料、向老師請教,最后通過努力完成了任務(wù)。七、源程序清單,并在腳本中編寫如下內(nèi)容:create database library。use library。create table books(id char(10) not null primary key,name char(50) not null,writer char(50),storage char(10))。create table reader(id char(10) not null primary key,name char(50) not null,password char(15),enable char(2) default 1)。create table admi(id char(10) not null primary key,name char(50) not null,password char(15))。create table borrow(r_id char(10) not null,b_id char(10) not null,b_date date,status char(2),primary key(b_id,r_id),foreign key(b_id) references books(id) on delete cascade on update cascade,foreign key(r_id) references reader(id) on delete cascade on update cascade)。insert into books values (1,book1,a,5)。insert into books values (2,book2,b,6)。insert into books values (3,book3,c,6)。insert into books values (4,book4,d,10)。insert into books values (5,book5,e,9)。insert into books values (6,book6,f,4)。insert into books values (7,book7,g,7)。insert into reader values (00000,youke,123,1)。insert into admi values (11111,root,123)。include include include include sys/include sys/include netinet/include includemysql/includedefine rec_length 20getm(char buf[],char result[][10][50]) //change format{ char *ip=NULL,*op=NULL,*temp=NULL,*p=NULL,*tmp=NULL。 int i=0,j=0,n=0。 temp=(char *)malloc(strlen(buf))。 strcpy(temp,buf)。 p=temp。 strtok_r(temp,。,amp。op)。 while((tmp=strtok_r(NULL,。,amp。op))!=NULL) { p=tmp。 while((tmp=strtok_r(p,amp。ip))!=NULL) { strcpy(result[i][j],tmp)。 p=NULL。 j++。 } i++。 j=0。 } free(temp)。}int opdb(char *cmd,char *p,int flag) //operate database{ MYSQL mysql。 MYSQL_RES *result。 MYSQL_ROW row。 int i,j,n=0。 char buf[256]。 if(mysql_init(amp。mysql)==NULL) { printf(db init error!\n)。 return 1。 } printf(Init db successfully!\n)。 if(!mysql_real_connect(amp。mysql,localhost,root,0,library,0,NULL,0)) { printf(Connect error!\n)。 mysql_close(amp。mysql)。 return 1。 } printf(Connect db successfully!\n)。 printf(cmd=%s\n,cmd)。 if(mysql_query(amp。mysql,cmd)!=0) { printf(query database wrong!\n)。 mysql_close(amp。mysql)。 return 1。 } if(flag==1) { printf(bbbbbbbbbbbbb\n)。 if((result=mysql_store_result(amp。mysql))==NULL) { mysql_free_result(result)。 mysql_close(amp。mysql)。 return 1。 } n=mysql_num_rows(result)。 } i=0。 j=0。 if(p!=NULL) { bzero(buf,sizeof(buf))。 while((row=mysql_fetch_row(result))) { strcat(buf,。)。 strcat(buf,row[0])。 for(i=1。imysql_num_fields(result)。i++) { strcat(buf,)。
點(diǎn)擊復(fù)制文檔內(nèi)容
語文相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1