Welcome, Guest
Username: Password: Remember me
Hier wird Deutsch gesprochen
  • Page:
  • 1

TOPIC:

DBServer Init/Constructor anpassen 11 Mar 2021 08:37 #17740

  • Horst
  • Horst's Avatar
  • Topic Author


  • Posts: 243
  • Hallo Leute
    Bei Cavo gabs die RDD Classes SDK und da konnte man nachschauen was z.B. METHOD Init( oFile, lShareMode, lReadOnlyMode, xDriver, aRdd ) CLASS DbServer macht und evt. in einer eigenen Klasse anpassen.
    Wollte das auch bei X# machen, mal reinschauen und evt. erweitern. Finde aber keine Methode wie die Init() von Cavo und die Constructor Methode ist da ziemmlich klein.
    Wo finde ich das ?
    Ich war auf - github.com/X-Sharp/XSharpPublic/blob/mai...harp.Rdd/Dbf/DBF.prg
    Gruss
    Horst

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

    DBServer Init/Constructor anpassen 11 Mar 2021 09:04 #17741

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2726
  • Hallo Horst,
    das, was Du da anschaust, hast Du bei VO nie gesehen, denn das sind die Quellen des RDDs selber.
    Und da durchzublicken, wird schon schwierig.
    Ich habe mich eine Weile damit befasst, weil ich eine eigene Server-Klasse gebaut habe, die auf den RDD-Klassen aufsetzt.
    Was Du hier siehst, ist eine ganze Hierarchie von Klassen und Interfaces, die aufeinander aufsetzen, und die leider nicht dokumentiert sind - wäre auch so ein Punkt auf meiner Liste, der nie erledigt werden wird.
    Wenn Dich der Code der DBServer-Klassen interessiert, musst Du woanders nachschauen - das ist aber der identische Code, wie Du ihn in VO findest.
    lg
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    DBServer Init/Constructor anpassen 11 Mar 2021 09:57 #17742

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hallo Wolfgang
    Habe jetzt weiter gesucht und bin nun hier fündig geworden.
    github.com/X-Sharp/XSharpPublic/blob/mai...ses_SDK/DBServer.prg

    Danke

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

    DBServer Init/Constructor anpassen 11 Mar 2021 10:00 #17743

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2726
  • Hallo Horst,
    ja, genau, das sind die Quellen für den VO-DBServer.
    Das andere ist das RDD selber.
    lg
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    DBServer Init/Constructor anpassen 11 Mar 2021 17:02 #17754

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hallo Wolfgang
    Die original Constructor Methode ruft Super() auf , gemeint ist da der Constructor von DataServer (denke ich). Wen ich das einfach mache ruft er doch die Contructor Methode von DBServer auf. Oder ? Das will ich ja nicht. Wie komme ich auf die Constructor Methode von DataServer ?
    Gruss
    Horst

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

    DBServer Init/Constructor anpassen 11 Mar 2021 17:07 #17755

    • robert
    • robert's Avatar


  • Posts: 2308
  • Hort,
    If I understand you correctly you want to skip the constructor in the parent class and call the constructor of the grandparent directly.
    That is not allowed in .Net.

    Robert
    XSharp Development Team
    The Netherlands

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

    DBServer Init/Constructor anpassen 11 Mar 2021 17:44 #17757

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hello Robert
    I wanna replace the Constructor Method of DBServer with my one.

    I only change some code

    nCnt := 10 // X Versuche HK
    DO WHILE nCnt > 0
    lRetCode := VoDbUseArea( FALSE, rddList, oFileSpec:FullPath, Symbol2String( symAlias ), ;
    lShared, lReadOnly )
    IF ! lRetCode
    nCnt --
    dTicker := Seconds ()
    DO WHILE TRUE
    IF Seconds () - dTicker > 1.0
    EXIT
    ENDIF
    ENDDO
    ENDIF
    ENDDO

    And now i am not sure what Method my Super () is calling.
    The Super() of DBServer or the Super() of DateServer.

    Horst

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

    DBServer Init/Constructor anpassen 11 Mar 2021 20:50 #17759

    • robert
    • robert's Avatar


  • Posts: 2308
  • Horst,
    Replacing a constructor is NOT possible. The .Net framework does not allow that.
    You can create a subclass and write a constructor in the subclass, but eventually you will have to call SUPER() somewhere. If you don't do that then the compiler will insert a call to SUPER().
    You could consider to open the file and then call SUPER() without parameters. This will however generate an error inside the DbServer constructor and the RECOVER USING clause inside the DbServer constructor the area will be closed again. If you really want to replace the constructor then you will have to create your own version of the DbServer class, copy the existing code and adjust the constructor.

    Robert
    XSharp Development Team
    The Netherlands

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

    DBServer Init/Constructor anpassen 11 Mar 2021 21:02 #17760

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • There's a trick that you can use in the VO dialect:

    - Copy ALL the code of the DBServer constructor() from github.com/X-Sharp/XSharpPublic/blob/fea...ses_SDK/DBServer.prg to the constructor of your own class.

    - Replace the SUPER() call in the beginning of it with:

    IF FALSE
      SUPER() // trick the compiler into thinking that you are calling the parent constructor
    ENDIF
    SELF:aClients := { } // this is the only command in the DataServer constructor

    This trick will make the compiler emit code that does not call ANY of the parent constructors at all. But because in this case the DataServer constructor only has one line of code, it is easy to use this trick.

    Robert please do not disable this dirty hack, I had needed to use this in other projects as well :)
    XSharp Development Team
    chris(at)xsharp.eu

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

    Last edit: by Chris.

    DBServer Init/Constructor anpassen 11 Mar 2021 21:33 #17761

    • robert
    • robert's Avatar


  • Posts: 2308
  • Chris,
    You naughty boy !

    Robert
    XSharp Development Team
    The Netherlands

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

    DBServer Init/Constructor anpassen 11 Mar 2021 21:54 #17762

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • :)
    XSharp Development Team
    chris(at)xsharp.eu

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

    DBServer Init/Constructor anpassen 12 Mar 2021 07:22 #17763

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2726
  • Hi Chris,
    I have added a link to you trick on my pearls page:
    riedmann.it/xsharp/index.php
    It is worth to be remembered and to non go lost in the many informations of this forum.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    DBServer Init/Constructor anpassen 12 Mar 2021 13:28 #17764

    • Karl-Heinz


  • Posts: 678
  • robert wrote: Chris,
    You naughty boy !

    Robert


    yeah, Chris is
    ? OrdIsUnique()  //  TRUE
    :-)

    i´m sure, in his earlier living he´s also been one of the famous 300 ;-)

    regards
    Karl-Heinz

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

    DBServer Init/Constructor anpassen 12 Mar 2021 16:17 #17766

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hallo Chris

    Thanks a lot for that trick !

    Horst

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

    DBServer Init/Constructor anpassen 12 Mar 2021 16:23 #17768

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Karl-Heinz,

    Nah, being the anti-war person that I am, at most maybe I could had been their cook ;)
    XSharp Development Team
    chris(at)xsharp.eu

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

    DBServer Init/Constructor anpassen 12 Mar 2021 17:15 #17773

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hi Robert

    In the Constructor Method on line 854 i found SELF:nReTries := LockTries( ) . Looking around i found RuntimeState.LockTries .
    What is your default value ? Cant find it.

    Horst

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

    DBServer Init/Constructor anpassen 12 Mar 2021 17:29 #17775

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Horst,

    You can simply write this to see the default value:

    ? LockTries() // 10

    You can see it being set in the file github.com/X-Sharp/XSharpPublic/blob/fea...re/State/EnumSet.prg , in the method RuntimeStateDefaultValue(), at line 871 currently:

    CASE Set.Locktries
    RETURN 10U
    XSharp Development Team
    chris(at)xsharp.eu

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

    DBServer Init/Constructor anpassen 12 Mar 2021 18:08 #17777

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Hi Chris

    lol
    ? LockTries() realy the simple way .

    Is __DBSAPPEND( lLocks, nTries ) also visible on Hithub ? Cant see a search function on Github :-(

    Horst

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

    DBServer Init/Constructor anpassen 12 Mar 2021 18:24 #17778

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Horst,

    It's defined here github.com/X-Sharp/XSharpPublic/blob/fea...sses_SDK/DBFuncs.prg

    You can download the whole runtime source, by clicking on the green "Code" button at the right of the page here: github.com/X-Sharp/XSharpPublic/tree/feature/Runtime Then you can open the whole runtime solution in VS from the Runtime.sln file. For XIDE, you can use the Runtime.xiproj file (just double click and open with XIDE) for the regular runtime and the \Runtime\VOSDK\xSharp - VOSDK-x.viproj file for the SDK. Then you can navigate through the code from within the IDE locally!
    XSharp Development Team
    chris(at)xsharp.eu

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

    DBServer Init/Constructor anpassen 13 Mar 2021 14:17 #17782

    • Horst
    • Horst's Avatar
    • Topic Author


  • Posts: 243
  • Thanks Chris

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

    • Page:
    • 1
    Moderators: wriedmann