[bug_fixed] Error opening Query (ZEOS_TESTING_REV_66)

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

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

[bug_fixed] Error opening Query (ZEOS_TESTING_REV_66)

Post by gto »

Hello there

I've tried that version with an already built app. When it reaches the very first query.open (the user authentication table), a Range Check Error popup.

The procedure which pops the exception is TZSQLDA.InitFields. On my actual working version of zeos (CVS-13/10/2005, some little mods by myself), the procedure stands on line 1333 of ZDbcInterbase6Utils, and has the following code:

Code: Select all

procedure TZSQLDA.InitFields(Parameters: boolean);
var
   I: Integer;
   SqlVar: PXSQLVAR;
begin
{$RANGECHECKS OFF}
   for I := 0 to FXSQLDA.sqld - 1 do
   begin
      SqlVar := @FXSQLDA.SqlVar[I];
      case SqlVar.sqltype and (not 1) of
         SQL_BOOLEAN, SQL_TEXT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_DATE,
            SQL_BLOB, SQL_ARRAY, SQL_QUAD, SQL_SHORT,
            SQL_LONG, SQL_INT64, SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT:
            begin
               if SqlVar.sqllen = 0 then
                  IbReAlloc(SqlVar.sqldata, 0, 1)
               else
                  IbReAlloc(SqlVar.sqldata, 0, SqlVar.sqllen)
            end;
         SQL_VARYING:
            IbReAlloc(SqlVar.sqldata, 0, SqlVar.sqllen + 2)
      end;

      if Parameters = True then
      begin
      //This code used when allocated sqlind parameter for Param SQLDA
         SqlVar.sqltype := SqlVar.sqltype or 1;
         IbReAlloc(SqlVar.sqlind, 0, SizeOf(Short))
      end else begin
      //This code used when allocated sqlind parameter for Result SQLDA
         if (SqlVar.sqltype and 1) <> 0 then
            ReallocMem(SqlVar.sqlind, SizeOf(Short))
         else
            SqlVar.sqlind := nil;
      end;
   end;
{$RANGECHECKS ON}
end;
Closer look to the $RANGECHECKS compiler directive.
In the new version, it's in the same file, but some lines above (1309), and has the following code:

Code: Select all

procedure TZSQLDA.InitFields(Parameters: boolean);
var
  I: Integer;
  SqlVar: PXSQLVAR;
begin
  { WAS RC OFF }
  for I := 0 to FXSQLDA.sqld - 1 do
  begin
    SqlVar := @FXSQLDA.SqlVar[I];
    case SqlVar.sqltype and (not 1) of
      SQL_BOOLEAN, SQL_TEXT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_DATE,
      SQL_BLOB, SQL_ARRAY, SQL_QUAD, SQL_SHORT,
      SQL_LONG, SQL_INT64, SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT:
        begin
          if SqlVar.sqllen = 0 then
            IbReAlloc(SqlVar.sqldata, 0, 1)
          else
            IbReAlloc(SqlVar.sqldata, 0, SqlVar.sqllen)
        end;
      SQL_VARYING:
          IbReAlloc(SqlVar.sqldata, 0, SqlVar.sqllen + 2)
    end;

    if Parameters = True then
    begin
      //This code used when allocated sqlind parameter for Param SQLDA
      SqlVar.sqltype := SqlVar.sqltype or 1;
      IbReAlloc(SqlVar.sqlind, 0, SizeOf(Short))
    end else begin
      //This code used when allocated sqlind parameter for Result SQLDA
      if (SqlVar.sqltype and 1) <> 0 then
        ReallocMem(SqlVar.sqlind, SizeOf(Short))
      else
        SqlVar.sqlind := nil;
    end;    
  end;
  { WAS RC ON }
end;
Note that RANGECHECKS isn't disabled anymore.
Anyone know why it's enabled now? The exactly line which pops the exception is SqlVar := @FXSQLDA.SqlVar;, when the I counter have value 1 (there's a 0 iteration before, and it runs well). Dunno if I can enable it. So I came here :)

[]'s


EDIT:

I cannot reply in this forum, so, it goes here:
The bug is already Fixed!
But always remember to disable the Debug Version (enabling Release Version) into Zeos.inc.
Last edited by gto on 28.08.2006, 14:25, edited 2 times in total.
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi gto,

We have fixed this problem in SVN version already. You can find some more information here

Basicly : until you use SVN testing branch version you should re-enable the RC compiler directives.

What we did inSVN: we switch range checking of as soon as possible when in debugging mode (zeos.inc). For release versions range checking is always off completely.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi gto,

Canyou confirm this is fixed? So I can put the '[ bug_fixed]' symbol. (you can eventually do it yourself as well)

Mark
Post Reply