Link to home
Start Free TrialLog in
Avatar of mvbortolli
mvbortolliFlag for Brazil

asked on

Range check error with Delphi 7, Zeos, Postgresql

Running Delphi 7 with Zeos and Potgresql, occurs "Range check error" on Zeos, on zdbcCache.pas, on line

          FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]] := 0;

It's weird, cause it's running early. I'm using Postgres 8.2 now, but testing with 8.3 and nothing.
Zeos Version 6.6.3 stable.

procedure TZRowAccessor.SetPChar(ColumnIndex: Integer; Value: PChar);
begin
{$IFNDEF DISABLE_CHECKING}
  CheckColumnConvertion(ColumnIndex, stString);
{$ENDIF}
  case FColumnTypes[ColumnIndex - 1] of
    stString:
      begin
        if Value <> nil then
        begin
          FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]] := 0;
          StrLCopy(@FBuffer.Columns[FColumnOffsets[ColumnIndex - 1] + 1], Value,
            FColumnLengths[ColumnIndex - 1] - 1);
        end else
          FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]] := 1;
      end;
    else
      SetString(ColumnIndex, Value);
  end;
end;

Open in new window

Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

  1. Run this in debug mode with a breakpoint on line 11;
  2. When it hits the breakpoint, check the value of ColumnIndex;
  3. Next check the value of FColumnOffsets[ColumnIndex - 1];
I suspoect that step 3 above will give you your answer.  
By the way, these are steps I would use in debugging this problem if it were in an application I was writing.
ASKER CERTIFIED SOLUTION
Avatar of rfwoolf
rfwoolf
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mvbortolli

ASKER

I find the problem. Unafortunately, just Zeos version 6.5.1 is compatible with my postgresql database. So, I download early version and problem solved. Thanks.