a veeerrrry old VO DBStruct() thing ...
Posted: Wed Mar 11, 2020 1:00 pm
When comparing some VO and X# DB functions I noticed these differences when no table is open.
VO
DBStruct() -> empty array
AFields() -> 0
X#
DBStruct() -> no table exception
AFields() -> no table exception
Ok, now the 2 cents
question: The snippet is part of the VO-SP3 DBStruct() sources. Which essential piece of code is missing in the IF ! Used() condition branch ? :huh:
![Wink ;-)](https://dt9qzg9h465rt.cloudfront.net/phpBB3/images/smilies/icon_e_wink.gif)
regards
Karl-Heinz
VO
DBStruct() -> empty array
AFields() -> 0
X#
DBStruct() -> no table exception
AFields() -> no table exception
Ok, now the 2 cents
![Wink ;-)](https://dt9qzg9h465rt.cloudfront.net/phpBB3/images/smilies/icon_e_wink.gif)
Code: Select all
FUNCTION DbStruct() AS ARRAY PASCAL
LOCAL aStruct AS ARRAY
LOCAL nFCount AS DWORD
LOCAL nProps AS DWORD
LOCAL i,j AS DWORD
LOCAL aField AS ARRAY
LOCAL xNewVal AS USUAL
aStruct := {}
nFCount := FCount()
IF !Used()
ptrErrInfo := _VODBErrInfoPtr()
ptrErrInfo.dwGenCode := EG_NOTABLE
ptrErrInfo.dwSubCode := EDB_NOTABLE
ptrErrInfo.pszSubSystem := Cast2Psz("DBCMD")
ptrErrInfo.dwSeverity := ES_ERROR
ptrErrInfo.lCanDefault := .T.
ptrErrInfo.symFuncSym := #DBSTRUCT
DefErrorGen(ptrErrInfo)
ELSE
FOR i := 1 UPTO nFCount
aField := {}
...
![Wink ;-)](https://dt9qzg9h465rt.cloudfront.net/phpBB3/images/smilies/icon_e_wink.gif)
regards
Karl-Heinz