问题 填空题

阅读以下说明,根据要求回答下列问题。
[说明]
某商场客户一商品数据库中的各关系模式如下。
客户(客户号,姓名,性别,年龄)
商品(商品号,名称,型号,品牌,单价,库存)
销售(流水号,

客户号

,

商品号

,数量,日期)
采购(商品号,数量)
其中:
(1)一种品牌的同一名称商品可以有多个型号,商品的库存有大于等于0的约束。
(2)销售表记录每一笔销售,每销售一件商品,其库存都要做相应的修改。
现假定已经建立了该数据库及上述4个基本表。

实现销售业务的嵌入式SQL代码段(嵌入C语言)如下,假设销售表的流水号由系统自动生成。请将空缺部分补充完整。

EXEC SQL BEGIN DECLARE SECTION;
/*销售:商品号,客户号,数量,日期*/
char pno[6]; char cno[6];
int quantity; char date[10];
EXEC SQL END DECLARE SECTION;

EXEC SQL CONNECT TO DEFAULT;
EXEC SQL SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
EXEC SQL INSERT INTO 销售(商品号,客户号,数量,日期)
VALUES (______);
EXEC SQL UPDATE 商品 SET 库存=______ WHERE 商品号=:pno;
if(SQLCA.SQLCODE!=0){
printf("商品%s库存不满足本次购买数量,交易失败!",pno);
EXEC SQL ROLLBACK WORK;
}else{
EXEC SQL ______;
}
EXEC SQL DI SCONNECT CURRENT;

答案

参考答案::pno,:cno,:quantity,:date
库存-:quantity
COMMIT WORK或COMMIT

解析:这是一道要求读者掌握嵌入式SQL的综合分析题,本题的解答思路如下。
空缺处考查嵌入式SQL程序中主变量的应用,处应填入“:pno,:cno,:quantity,:date”,处应填入“库存-:quantity”。
每执行完一个SQL语句,SQLCA中的SQLCODE给出该语句执行的结果情况。根据嵌入C程序流程可知,else表示SQL语句能成功执行的分支,因此空缺处应填入“COMMIT WORK(或COMMIT)”。

阅读理解

阅读理解。

        On the evening of June 21, 1992, a tall man with brown hair and blue eyes entered the beautiful hall

of the Bell Tower Hotel in Xi’an with his bicycle. The hotel workers received him and telephoned the

manager, for they had never seen a bicycle in the hotel ball before though they lived in “the kingdom of

bicycles.”    

        Robert Friedlander, an American, arrived in Xi’an on his bicycle trip across Asia which started last

December in New Delhi, India.    

        When he was 11, he read the book Marco Polo and made up his mind to visit the Silk Road. Now,

after 44 years , he was on the Silk Road in Xi’an and his early dreams were coming true.     

        Robert Friedlander’s next destinations (目的地) were Lanzhou, Dunhuang, Urumqi, etc. He will

complete his trip in Pakistan.

1. The best headline(标题) for this newspaper article would be ______     .  

A. The Kingdom of Bicycles        

B. A Beautiful Hotel in Xi’an   

C. Marco Polo and the Silk Road  

D. An American Achieving His Aims

2. Friedlander is visiting the three countries in the following order, _______   .  

A. China, India, and Pakistan    

B. India, China, and Pakistan   

C. Pakistan, China, and India    

D. China, Pakistan, and India

3. What made Friedlander want to come to China?  

A. The stories about Marco Polo .

B. The famous sights in Xi’an .  

C. His interest in Chinese silk.  

D. His childhood dreams about bicycles .

4. Friedlander can be said to be _______      .  

A. clever    

B. friendly    

. hardworking

D. strong-mindedC

单项选择题