Page 1 of 1

tzquery.Locate problem and dirty fix

Posted: 31.08.2006, 06:52
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.

Posted: 31.08.2006, 08:36
by mdaems
Looks like it is fixed in SVN version.

Why don't you use a more recent version?

Mark

Posted: 31.08.2006, 14:21
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 ;)

Posted: 31.08.2006, 16:52
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.