Error compiling v 6.5.1 in Delphi 5 Enterprise

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

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Zevang
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 25.11.2005, 17:36

Error compiling v 6.5.1 in Delphi 5 Enterprise

Post by Zevang »

Hi all,

My first time here, although I use Zeoslib for quite sometime now...

Problem now is that I've got a job transfer. I use Delphi 5 Enterprise Edition, and when I try to compile Zeos 6.5.1 I get an error concerning a Datautils.dcu missing.

Searching D5 installation, I saw no Datautils.dcu, but Datautil.dcu.
Yet, the package I was compiling (ZDbc) complained about a function that actually does not exist in the D5 original package (DecodeDateTime).

Am I doing something wrong? Do I have to use another version?

thanks in advance

Zevang
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Unfortunately Delphi 5 compatibility has been lost since the 2004 release of 6.5.1-alpha. You can use this 2004 release from sourceforge until the developers have fixed this unconvenience. (I do so and had not to much trouble in my simple appications) See other items in this forum.

Mark
Image
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

Suggestion: Use a previous version.
Zevang
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 25.11.2005, 17:36

Post by Zevang »

Thanks Mark and Zippo,

I'll try both suggestions.

Zevang
Zevang
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 25.11.2005, 17:36

Post by Zevang »

Hi all.
It's just to tell you that I've got a working connection using the following:
-Delphi 5
-MySql 5
-Zeoslib 6.5.1 alpha (2004 edition)
Although not yet in production, I think it will be working stable.

thank you all

Zevang
A99
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.12.2005, 12:07

Post by A99 »

Dear developers! I have a quastion. Whether it's planned to solve in the near future a problem with Delphi 5 & Zeos 6.5.1? Please solve a problem or declare the termination of old Delphi releases support.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

It seems to me that the only file you need to change to get this working is ZDbcMySqlStatement.pas.

Replace

Code: Select all

function TZMySQLPreparedStatement.PrepareSQLParam(ParamIndex: Integer): string;
var
  Value: TZVariant;
  TempBytes: TByteDynArray;
  TempBlob: IZBlob;

  AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word;
begin
  TempBytes := nil;
  if InParamCount <= ParamIndex then
    raise EZSQLException.Create(SInvalidInputParameterCount);

  Value := InParamValues[ParamIndex];
  if DefVarManager.IsNull(Value) then
    if (InParamDefaultValues[ParamIndex] <> '') and
      StrToBoolEx(DefineStatementParameter(Self, 'defaults', 'true')) then
      Result := InParamDefaultValues[ParamIndex]
    else
      Result := 'NULL'
  else begin
    case InParamTypes[ParamIndex] of
      stBoolean:
        if SoftVarManager.GetAsBoolean(Value) then Result := '''Y'''
        else Result := '''N''';
      stByte, stShort, stInteger, stLong, stBigDecimal, stFloat, stDouble:
        Result := SoftVarManager.GetAsString(Value);
      stString, stBytes:
        Result := GetEscapeString(SoftVarManager.GetAsString(Value));
      stDate:
      begin
        DecodeDateTime(SoftVarManager.GetAsDateTime(Value),
          AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond);
        Result := '''' + Format('%0.4d-%0.2d-%0.2d',
          [AYear, AMonth, ADay]) + '''';
      end;
      stTime:
      begin
        DecodeDateTime(SoftVarManager.GetAsDateTime(Value),
          AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond);
        Result := '''' + Format('%0.2d:%0.2d:%0.2d',
          [AHour, AMinute, ASecond]) + '''';
      end;
      stTimestamp:
      begin
        DecodeDateTime(SoftVarManager.GetAsDateTime(Value),
          AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond);
        Result := '''' + Format('%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d',
          [AYear, AMonth, ADay, AHour, AMinute, ASecond]) + '''';
      end;
      stAsciiStream, stUnicodeStream, stBinaryStream:
        begin
          TempBlob := DefVarManager.GetAsInterface(Value) as IZBlob;
          if not TempBlob.IsEmpty then
            Result := GetEscapeString(TempBlob.GetString)
          else Result := 'NULL';
        end;
    end;
  end;
end;
with

Code: Select all

function TZMySQLPreparedStatement.PrepareSQLParam(ParamIndex: Integer): string;
var
  Value: TZVariant;
  TempBytes: TByteDynArray;
  TempBlob: IZBlob;

  AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word;
begin
  TempBytes := nil;
  if InParamCount <= ParamIndex then
    raise EZSQLException.Create(SInvalidInputParameterCount);

  Value := InParamValues[ParamIndex];
  if DefVarManager.IsNull(Value) then
    if (InParamDefaultValues[ParamIndex] <> '') and
      StrToBoolEx(DefineStatementParameter(Self, 'defaults', 'true')) then
      Result := InParamDefaultValues[ParamIndex]
    else
      Result := 'NULL'
  else begin
    case InParamTypes[ParamIndex] of
      stBoolean:
        if SoftVarManager.GetAsBoolean(Value) then Result := '''Y'''
        else Result := '''N''';
      stByte, stShort, stInteger, stLong, stBigDecimal, stFloat, stDouble:
        Result := SoftVarManager.GetAsString(Value);
      stString, stBytes:
        Result := GetEscapeString(SoftVarManager.GetAsString(Value));
      stDate:
      begin
        DecodeDate(SoftVarManager.GetAsDateTime(Value),
          AYear, AMonth, ADay);
        Result := '''' + Format('%0.4d-%0.2d-%0.2d',
          [AYear, AMonth, ADay]) + '''';
      end;
      stTime:
      begin
        DecodeTime(SoftVarManager.GetAsDateTime(Value),
          AHour, AMinute, ASecond, AMilliSecond);
        Result := '''' + Format('%0.2d:%0.2d:%0.2d',
          [AHour, AMinute, ASecond]) + '''';
      end;
      stTimestamp:
      begin
        DecodeDate(SoftVarManager.GetAsDateTime(Value),
          AYear, AMonth, ADay);
        DecodeTime(SoftVarManager.GetAsDateTime(Value),
          AHour, AMinute, ASecond, AMilliSecond);
        Result := '''' + Format('%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d',
          [AYear, AMonth, ADay, AHour, AMinute, ASecond]) + '''';
      end;
      stAsciiStream, stUnicodeStream, stBinaryStream:
        begin
          TempBlob := DefVarManager.GetAsInterface(Value) as IZBlob;
          if not TempBlob.IsEmpty then
            Result := GetEscapeString(TempBlob.GetString)
          else Result := 'NULL';
        end;
    end;
  end;
end;
and remove DateUtils from the Uses clause. Is that all that needs to be done? I haven't got Delphi 5 to check.

Regards,

Ben
A99
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.12.2005, 12:07

Post by A99 »

Sorry, but problem with Delphi 5 is not solved with DateUtils removing. ZeosDbo 6.5.1 uses some units (Variants, Types) not presented in Delphi 5 Enterprise. Some field (ftTimestamp) and variant types (varInt64, varWord, varLongWord) are not presented.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

A bit more complicated than I thought!

I think the Types unit was mostly extracted from some other units in Delphi 6 (To allow for Kylix compatibility) but Delphi 6 also overhauled lots of stuff to do with Variants so I think this may be a struggle.

Anyone else have any ideas?

Ben
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I think somebody with CVS-access, D5 and D6 should track back the incompatible changes and check if these changes can be implemented without the problematic units or with version-specific code.
I hope the dev team can find somebody who is willing to do this 'job from hell'. And indeed, if they don't they will have to take the decision and make it official.

Mark
Image
Post Reply