tzquery.Locate problem and dirty fix

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
gluquesan
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.12.2005, 04:12

tzquery.Locate problem and dirty fix

Post by gluquesan »

I work with a PGSQL database (8.x) and when I try to perfom a zquery.locate with multiple fields, sometimes works, another fails. Then in most of the cases the problem appeared when one of the fields was a integer field.

In CompareFieldsFromResultSet method at ZDatasetUtils.pas this instruction:

Code: Select all

CurrentType := ResultSet.GetMetadata.GetColumnType(ColumnIndex);
returns for integer fields (in my case sometimes) a CurrenType of stShort, and this one is not evaluated later at the case statment, then I modified the case statement:

Before

Code: Select all

case CurrentType of
  ...
  stInteger:
  ...
After

Code: Select all

case CurrentType of
  ...
  stInteger, stShort:
  ...
and since this dirty fix works fine. I hope that it can be useful for somebody. Maybe in a recent version that trouble was fixed. (i use an "old" 6.5.1 version).



Guillermo Luque y Guzman Saenz
LGS Ingenieria Ltda.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Looks like it is fixed in SVN version.

Why don't you use a more recent version?

Mark
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post by gto »

Yes, it's corrected. In SVN 99 :

Code: Select all

      case CurrentType of
        stBoolean:
          begin
            Result := KeyValues[I].VBoolean =
              ResultSet.GetBoolean(ColumnIndex);
          end;
        stByte,
        stShort,
        stInteger,
        stLong:
          begin
            Result := KeyValues[I].VInteger =
              ResultSet.GetLong(ColumnIndex);
          end;
        stFloat,
        stDouble,
        stBigDecimal:
          begin
            Result := Abs(KeyValues[I].VFloat -
              ResultSet.GetBigDecimal(ColumnIndex)) < FLOAT_COMPARE_PRECISION;
          end;
          ...
I hardly recommend you to update your version through SVN or here ;)
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
gluquesan
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.12.2005, 04:12

Post by gluquesan »

Yes mdaems & gto: I'm working with the 23-09-05 6.5.1 version, and don't see any svn source. Thanks for your info!. I'm going to download svn version and use it soon.

Guillermo Luque y Guzman Saenz
LGS Ingenieria Ltda.
Post Reply