Error compiling v 6.5.1 in Delphi 5 Enterprise
Moderators: gto, cipto_kh, EgonHugeist
Error compiling v 6.5.1 in Delphi 5 Enterprise
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
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
It seems to me that the only file you need to change to get this working is ZDbcMySqlStatement.pas.
Replace
with
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
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;
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;
Regards,
Ben
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
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
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