某高速路不停车收费系统(ETC)的业务描述如下:
(1)车辆驶入高速路入口站点时,将驶入信息(ETC卡号,入口编号,驶入时间)写入登记表;
(2)车辆驶出高速路出口站点(收费口)时,将驶出信息(ETC卡号,出口编号,驶出时间)写入登记表;根据入口编号、出口编号及相关收费标准,清算应缴费用, 并从绑定的信用卡中扣除费用。
一张ETC卡号只能绑定一张信用卡号,针对企业用户,一张信用卡号可以绑定多 个ETC卡号。使用表绑定(ETC卡号,信用卡号)来描述绑定关系,从信用卡(信用卡号,余额)表中扣除费用。
针对上述业务描述,完成下列问题:
【问题1】(4分)
在不修改登记表的表结构和保留该表历史信息的前提下,当车辆驶入时,如何保 证当前ETC卡已经清算过,而在驶出时又如何保证该卡已驶入而未驶出?请用100字以内文字简述处理方案。
【问题2】(5分)
当车辆驶出收费口时,从绑定信用卡余额中扣除费用的伪指令如下:读取信用卡余额到变量x,记为x=R(A);扣除费用指令x=x-a;写信用卡余额指令记为W(A,x)。
(1)当两个绑定到同一信用卡号的车辆同时经过收费口时,可能的指令执行序列为:x1=R(A),x1=x1-a1,x2=R(A),x2=x2-a2,W(A,x1),W(A,x2)。此时会出现什么问题?(100字以内)
(2)为了解决上述问题,引入独占锁指令XLock(A)对数据A进行加锁,解锁指令Unlock(A)对数据A进行解锁。请补充上述执行序列,使其满足2PL协议。
【问题3】(6分)
下面是用E-SQL实现的费用扣除业务程序的一部分,请补全空缺处的代码。
CREATE PROCEDURE 扣除(IN ETC 卡号 VARCHAR(20), IN 费用 FLOAT)
BEGIN
UPDATE 信用卡 SET 余额=余额-费用
FROM 信用卡,绑定
WHERE 信用卡.信用卡号=绑定.信用卡号 AND (a) ;
if error then ROLLBACK;
else (b) ;
END
正确答案及解析
正确答案
解析
【问题1】在车辆驶入时判定登记表上对应ETC卡的所有记录,出口编号和驶出时间均不为空,表示该卡已清算过,在车辆驶出时判定该卡存在记录有驶入信息出口编号和驶出时间为空
【问题2】出现丢失更新
【问题3】
a、绑定.ETC卡号=ETC卡号
b、COMMIT
包含此试题的试卷
你可能感兴趣的试题
Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.
- 
                
- A.Artificial Intelligence
 - B.Cloud Computing
 - C.Internet of Things
 - D.Big Data
 
 - 查看答案
 
In project human resource management , ( )is not a source of power for the project manager.
- 
                
- A.referent power
 - B.expert power
 - C.reward power
 - D.audit power
 
 - 查看答案
 
At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.
- 
                
- A.detail feasibility analysis
 - B.opportunity analysis
 - C.economic feasibility analysis
 - D.risk analysis
 
 - 查看答案
 
( )is a grid that shows the project resources assigned to each work package.
- 
                
- A.Stakeholder engagement assessment matrix
 - B.Requirements traceability matrix
 - C.Probability and impact matrix
 - D.Responsibility assignment matrix
 
 - 查看答案
 
Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.
- 
                
- A.digital
 - B.networking
 - C.intelligentize
 - D.informatization
 
 - 查看答案