I was reported that the Advantage Delphi client doesn’t return NULL on MONEY data type in Delphi Tokyo. After some research, I’ve found a bug in adsdata.pas: Line 5996 compares the data buffer with the value that represents NULL in ADS. It casts the content to a Signed64 for the comparison:

if ( pSIGNED64 ( pcData )^ <> $8000000000000000 ) then

All other comparisons in that function (TAdsDataSet.IsFieldBlank) compare to Unsigned values instead. So modifying the above line with

if ( PUNSIGNED64 ( pcData )^ <> $8000000000000000 ) then

fixes the issue.

Advantage returning wrong value on Null in Delphi Tokyo
Markiert in:             

14 Kommentare zu „Advantage returning wrong value on Null in Delphi Tokyo

  • 2. November 2017 um 17:05 Uhr
    Permalink

    Can you explain why only Tokyo is affected or does this fix apply to other versions as well?

    Antworten
    • 2. November 2017 um 17:55 Uhr
      Permalink

      Looks like only Tokyo is affected. I didn’t get the same issues compiling with Seattle or Berlin.

      Antworten
      • 2. November 2017 um 17:56 Uhr
        Permalink

        Strange, but good to know. Thank you very much.

        Antworten
  • 3. November 2017 um 7:38 Uhr
    Permalink

    Hello Joachim, on my adsdata.pas i have that in line 5986.
    Possible that we have an older file than you. Can you zip your tdataset source folder for Tokyo 10.2.1?

    Antworten
    • 3. November 2017 um 7:51 Uhr
      Permalink

      That might be. I’ve used V12, but did some modifications when trying to get it run under Linux. I’d suggest to use the official version, not mine;)

      Antworten
      • 3. November 2017 um 7:56 Uhr
        Permalink

        Ok and thanks Joachim.

        We’re using 11.10.0.30 tdataset components and think that we will not switch to v12.
        Lack of support will let us switch after 18 years away to another Db with ~2000 users.

        Antworten
  • 6. November 2017 um 15:24 Uhr
    Permalink

    Nice one. Works even with Version 10 TDataSet Components (though I’ve had to modify ace.pas too)

    Antworten
  • 16. Januar 2018 um 15:04 Uhr
    Permalink

    Wir verwenden Delphi 10.2 Update 2 und den ADS Client 11.10.30
    Die Installation hat Dank deiner Hilfe perfekt funktioniert.

    Die NULL Werte bei Money werden aber nicht korrekt angezeigt.

    In der adsdata.pas ist der Wert punsigned64 nicht bekannt.
    In der ace.pas wird dieser Wert auch nicht aufgeführt.
    Welche Möglichkeiten gibt es hierzu noch ?
    Eine Antwort wäre sehr nett.
    Vielen Dank

    Antworten
    • 16. Januar 2018 um 16:26 Uhr
      Permalink

      folgende Typ-Definitionen aus der ace.pas (V12):
      UNSIGNED64 = UInt64;
      PUNSIGNED64 = ^UNSIGNED64;
      Hilft Dir das weiter?

      Antworten
  • 24. Juni 2020 um 10:19 Uhr
    Permalink

    Hello Joachim.

    Thanks for the fix.
    Came from XE2 to Rio with the ADS 11.10.0.30.
    Since i use the V11 and not the V12, for which you wrote that post, there are few more entries for ADS_MONEY with pSIGNED64. Should that to be replaced too?

    Antworten
    • 24. Juni 2020 um 10:56 Uhr
      Permalink

      Stefan,
      I didn’t test with ADS V11 – which is fairly outdated btw 😉

      Antworten
      • 24. Juni 2020 um 18:58 Uhr
        Permalink

        Joachim, what advantages would it have to change to V12? What is different to V11 (for TAdsDataSet)?
        There are still support releases and bug fixes?
        Is it possible to use the V12 TAdsDataSet with an V11 server?

        Antworten
        • 24. Juni 2020 um 21:21 Uhr
          Permalink

          You need to update the server, too. V12 has some nice enhancements. See my post on V12.

          Antworten

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert