[bug?]"Range check error" and EConvertError with D

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

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Yoshio
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 11.03.2008, 06:05
Location: Japan
Contact:

[bug?]"Range check error" and EConvertError with D

Post by Yoshio »

Me again. :D

I'm taking "Range check error" when active ZTable at design and EConvertError at runtime. This occur if a table has a field Timestamp. I'm using "zeos 6.6.2-RC" with protocol oracle9i to connect in Oracle 10g.

The exception EConvertError raise in ZDbcOracleResultSet.pas, near of line 657:
------------------------------------------
Result := Result + EncodeTime(
Hour, Minute, Second, Millis);
------------------------------------------



I checked the values Hour, Minute, Second and Millis, all are numbers. The value of Millis was a large number like 123456789, but the argument MSec in EncodeTime should be <= 999 (Delphi Component Reference). To fix I do that:
------------------------------------------
uses
..., StrUtils;
...

{begin add}
Millis := StrToInt(LeftStr(IntToStr(Millis), 3)); // included in line 558
{end add}

Status := FPlainDriver.DateTimeGetTime(
Connection.GetConnectionHandle,
FErrorHandle, PPOCIDescriptor(SQLVarHolder.Data)^,
Hour, Minute, Second, Millis);
// CheckOracleError(FPlainDriver, FErrorHandle, Status, lcOther, '');
if Status = OCI_SUCCESS then
begin
if Result >= 0 then
begin
Result := Result + EncodeTime(
Hour, Minute, Second, Millis);
end
else
begin
Result := Result - EncodeTime(
Hour, Minute, Second, Millis);
end;
end;
------------------------------------------



I don't take more EConvertError at runtime, just a "Range check error" when active ZTable in design. This is ok or is better not use zeos with Oracle 10g?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

This is a difficult question. When you search around in the forum you'll see quite a lot of different 'solutions'. Unfortunately, there's no really active developer left using Oracle. Which means it's kind of 'desupported' for the moment.

I don't think it would be an enormous job to add add a fully working Oracle 10 protocol to Zeoslib based on the oracle 9 protocol. We only need somebody who commits himself to do it, and do it the 'right' way, not breaking the oracle 9 protocol. This will probably involve some study of the (changes of) the OCI protocol.
I'll leave the choise between 'inheriting from Oracle 9' and 'a copy of Oracle 9' to start from up to the developer. So, if you have some spare time to fix these issues, please do so and contact me.

About " Millis := StrToInt(LeftStr(IntToStr(Millis), 3)); " : is there no better way to do this? Like " Millis := Millis mod 1000; ". At least this doesn't involve String conversions.

Mark
Image
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

Maybe it helps when you convert the timestamp to a date using to_date, either in your query or, if you have to use a TZTable, by creating a view with the to_date conversion and using that view for the TZTable. As far as I remember the timestamp was only introduced in Oracle 10g. What Oracle client version do you use? But I had similar difficulties with a 10g client.
Post Reply