Sample DDfDump
<< Click to Display Table of Contents >>
Sample DDfDump
|
|
Purpose
DDFDump sample
Description
This sample shows how you can use the BtDD*Server classes to read information from the DDF Dictionary.
Example(s)
FUNCTION Start
LOCAL oFileSrv AS BtDDFileServer
LOCAL oFieldSrv AS BtDDFieldServer
LOCAL oCommSrv AS BtDDCommentServer
LOCAL oFieldExtSrv AS BtDDFieldExtServer
LOCAL nFile AS DWORD
LOCAL lComment AS LOGIC
LOCAL lFieldExt AS LOGIC
Bt_Path("D:")
SetAnsi(FALSE)
set alte on
set alte TO DDF.txt
oFileSrv := BtDDFileServer
oFieldSrv := BtDDFieldserver
oFileSrv:SetOrder(1)
oFileSrv:GoTop()
IF oFieldSrv:OrderInfo(DBOI_ORDERCOUNT) >= 5
oFieldsrv:SetOrder(5)
ELSE
oFieldsrv:SetOrder(4)
ENDIF
oFileSrv:SetSelectiveRelation(oFieldSrv, oFileSrv:FieldSym(1))
IF File("Comment.DDF")
lComment := TRUE
oCommSrv := BtDDCommentserver
oCommSrv:SetOrder(1) // Fileid + FieldId
oFieldSrv:SetRelation(oCommSrv, oFieldSrv:FieldSym(2), oFieldSrv:FieldSym(1))
ENDIF
IF File("FieldExt.DDF")
lFieldExt := TRUE
oFieldExtSrv := BtDDFieldExtserver
OFieldExtSrv:SetOrder(1) // Fileid + FieldId
oFieldSrv:SetRelation(oFieldExtSrv, oFieldSrv:FieldSym(2), oFieldSrv:FieldSym(1))
ENDIF
DO WHILE ! oFilesrv:Eof
nFile := oFileSrv:FieldGet(1)
Set Console On
? "File : ", NTrim(oFileSrv:FieldGet(1)), Trim(oFileSrv:FieldGet(2)), Trim(oFileSrv:FieldGet(3))
Set Console off
? "Field Information:"
? "---------------------------------------------------------------------"
? "Name Type Description Len Dec OffSet ExtType Comment"
? "---------------------------------------------------------------------"
oFieldSrv:GoTop()
DO WHILE ! oFieldSrv:Eof
? PadR(oFieldSrv:FieldGet(3),20), ;
PadR(oFieldSrv:FieldGet(4),4), ;
PadR(Bt_CvType(oFieldSrv:FieldGet(4),TRUE),11), ;
PadR(oFieldSrv:FieldGet(6),4), ;
PadR(oFieldSrv:FieldGet(7),3), ;
PadR(oFieldSrv:FieldGet(5),6),""
IF lFieldExt
?? PadR(oFieldExtSrv:FieldGet(3),8)
ELSE
?? Space(8)
ENDIF
IF lComment
?? PadR(oCommSrv:FieldGet(3),60)
ENDIF
oFieldSrv:Skip(1)
ENDDO
? "============================================================="
oFileSrv:Skip(1)
ENDDO
Set Console On
oFileSrv:Close()
oFieldSrv:Close()
IF oComMSrv != NULL_OBJECT
oComMSrv:Close()
ENDIF
IF oFieldExtSrv != NULL_OBJECT
oFieldExtSrv:Close()
ENDIF