Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

a veeerrrry old VO DBStruct() thing ... 11 Mar 2020 14:00 #13686

  • Karl-Heinz
  • Karl-Heinz's Avatar
  • Topic Author


  • Posts: 774
  • 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:
    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 := {}
    
    ...

    ;-)

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    a veeerrrry old VO DBStruct() thing ... 11 Mar 2020 18:19 #13696

    • Chris
    • Chris's Avatar


  • Posts: 3844
  • Hi Karl-Heinz,

    I am not sure i am seeing something. I would prefer FCount() to be in there, but since this is not throwing an error, it is not doing harm in practice. There's no RETURN in there either, but I think this is as designed, to allow the function (in VO) to return an empty array if something went wrong. Do you mean something about how the error is invoked?
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    a veeerrrry old VO DBStruct() thing ... 11 Mar 2020 21:13 #13698

    • Karl-Heinz
    • Karl-Heinz's Avatar
    • Topic Author


  • Posts: 774
  • Hi Chris,

    Yeah, it´s about the exception that´s prepared, but never thrown. Take a look at what DefErrorGen() returns and you know what´s missing.

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    a veeerrrry old VO DBStruct() thing ... 11 Mar 2020 23:39 #13700

    • Chris
    • Chris's Avatar


  • Posts: 3844
  • Hi Karl-Heinz,

    Ahh right!!! It was to obvious to notice it! :)
    Error constructed but never thrown..Guess the code should had been

    BREAK DefErrorGen(ptrErrInfo)

    so, do you agree that the behavior of X# is the correct (intended) one, so it should probably stay as it is now?
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    a veeerrrry old VO DBStruct() thing ... 12 Mar 2020 08:25 #13703

    • Karl-Heinz
    • Karl-Heinz's Avatar
    • Topic Author


  • Posts: 774
  • Hi Chris,

    Yes, because there´s is at least a VO plan to throw a exception :-)

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1