Problems with supporting Yaffil and CalcField char(1)

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MoonFox
Posts: 4
Joined: Tue 26 Jun 2007 15:09

Problems with supporting Yaffil and CalcField char(1)

Post by MoonFox » Tue 26 Jun 2007 16:03

Yaffil IB clone have version string like "WI-1.3.XXX...", but FireBird version string looks like "WI-V2.0.1.XXXXX".
During preparation of query under Yaffil thrown exception "'.' is not a valid integer value".
Corrected code of GetMajorServerVersion function in unit IBCClasses.pas:

Code: Select all

function TGDSConnection.GetMajorServerVersion: integer;
var
  VersionString: string;
  DotPos: Integer; // *** New line
begin
  if FMajorServerVersion = 0 then begin
    if IsFBServer then
      VersionString := FDatabaseInfo.FBVersion
    else
      VersionString := FDatabaseInfo.Version;
    if Length(VersionString) >= 7 then begin
{*** Old code
      FMajorServerVersion := StrToInt(VersionString[5]);
      FMinorServerVersion := StrToInt(VersionString[7]);
}
      // *** Start of new code
      DotPos := Pos('.', VersionString);
      if (DotPos > 1) and (DotPos < Length(VersionString)) then begin
        FMajorServerVersion := StrToInt(VersionString[DotPos - 1]);
        FMinorServerVersion := StrToInt(VersionString[DotPos + 1]);
      end;
      // *** End of new code
    end;
  end;
  Result := FMajorServerVersion;
end;
Second problem is calculated field type string(1).
Fill any legal select query in IBCQuery. Add all fields as persistent in fields editor and create new calculated field type string with size 1.
Write OnCalcFields event like:

Code: Select all

procedure TForm1.IBCQuery1CalcFields(DataSet: TDataSet);
begin
  with DataSet do
    FieldByName('FIELD1').AsString := '*';
end;
Connect query with DataSource and DBGrid. Break point in debugger on body of CalcFields procedure successfully executed, but DBGrid don't show "*" in corresponded column.
Any combination of Options property of IBCQuery cannot solve this problem. But calculated field type char(2) works fine!
Delphi 7 and IBDac 2.10

Sorry for my "english"!

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 27 Jun 2007 11:39

Thank you for the information. We have applied your fix with Yaffil server version detection. Also we have reproduced and fixed problem with calculated fields. This fixes will be included in the next IBDAC build.
If problem with calculated field is critical for you, please contact us via Email (ibdac*crlab*com), and we will send you this fix.

Post Reply