📄 risp.old
字号:
EXIT
ENDIF && not llretval
ENDSCAN get all of the 选课信息 records
=rireuse("选课信息",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "结束参照完整性更新触发器" 老师信息
********************************************************************************
********************************************************************************
procedure __RI_UPDATE_选课信息
** "参照完整性更新触发器" 选课信息
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("MYDATABASE")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="老师信息")
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(TNO)
lcOldChildID=oldval("ALLTRIM(TNO)")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ALLTRIM(TNO)"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("老师信息","tno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("老师信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "老师信息"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="学生信息")
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(SNO)
lcOldChildID=oldval("ALLTRIM(SNO)")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ALLTRIM(SNO)"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("学生信息","sno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("学生信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "学生信息"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="课程信息")
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(CNO)
lcOldChildID=oldval("ALLTRIM(CNO)")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ALLTRIM(CNO)"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("课程信息","cno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("课程信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "课程信息"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "结束参照完整性更新触发器" 选课信息
********************************************************************************
********************************************************************************
** "参照完整性插入触发器" 选课信息
PROCEDURE __RI_INSERT_选课信息
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("MYDATABASE")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(TNO)
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ALLTRIM(TNO)"
lcParentWkArea=riopen("老师信息","tno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("老师信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(SNO)
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ALLTRIM(SNO)"
lcParentWkArea=riopen("学生信息","sno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("学生信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ALLTRIM(CNO)
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ALLTRIM(CNO)"
lcParentWkArea=riopen("课程信息","cno")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("课程信息",lcParentWkArea)
IF NOT llRetVal
DO rierror with -1,"违反插入限制规则。","",""
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "结束参照完整性插入触发器" 选课信息
********************************************************************************
********************************************************************************
** "参照完整性删除触发器" 学生信息
PROCEDURE __RI_DELETE_学生信息
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("MYDATABASE")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ALLTRIM(SNO) TO lcParentID,pcParentID
pcParentExpr="ALLTRIM(SNO)"
lcChildWkArea=riopen("选课信息","sno")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SELECT (lcChildWkArea)
SEEK lcParentID
SCAN WHILE ALLTRIM(SNO)=lcParentID AND llRetVal
pnChildRec=recno()
pcChildID=ALLTRIM(SNO)
pcChildExpr="ALLTRIM(SNO)"
llRetVal=ridelete()
ENDSCAN get all of the 选课信息 records
=rireuse("选课信息",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "结束参照完整性删除触发器" 学生信息
********************************************************************************
********************************************************************************
procedure __RI_UPDATE_学生信息
** "参照完整性更新触发器" 学生信息
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("MYDATABASE")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ALLTRIM(SNO)")
pcParentID=lcOldParentID
pcParentExpr="ALLTRIM(SNO)"
lcParentID=ALLTRIM(SNO)
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("选课信息")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SELECT (lcChildWkArea)
SCAN FOR ALLTRIM(SNO)=lcOldParentID
pnChildRec=recno()
pcChildID=ALLTRIM(SNO)
pcChildExpr="ALLTRIM(SNO)"
llRetVal=riupdate("SNO",substr(lcParentID,1,0),"学生信息")
IF NOT llRetVal
EXIT
ENDIF && not llretval
ENDSCAN get all of the 选课信息 records
=rireuse("选课信息",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "结束参照完整性更新触发器" 学生信息
********************************************************************************
**__RI_FOOTER!@ Do NOT REMOVE or MODIFY this line!!!! @!__RI_FOOTER**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -