Range check error

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
hafedh.trimeche
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 18.11.2014, 13:36

Range check error

Post by hafedh.trimeche »

Compiler Delphi XE7 DEBUG Mode

Code: Select all

Functions.Add(TZAbsFunction.Create('ABS'));
raised exception (range check error) when calling the Hash function

Code: Select all

procedure TZFunctionsList.Add(Func: IZFunction);
var
  Index: Integer;
  aKey : LongInt;
  aName: string;

begin
  aName := Uppercase(Func.Name);
  aKey  := Hash({$IFDEF UNICODE}AnsiString{$ENDIF}(aName));
  Index := FindByKeyAndName(aKey, aName);
  if Index < 0 then
  begin
    FFunctions.Add(Func);
    SetKey(aKey, FFunctions.Count-1);
  end
  else
    raise TZExpressionError.Create('Function '+Func.Name+' already defined!');
end;
Regards
wiwiechris
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 08.05.2014, 14:58

Re: Range check error

Post by wiwiechris »

Hallo,
I ran into the same error (Use code ZEOS 7.2 svn Revision 3619 with D2010).
I think you found another example of a more general problem (See my postings in the 7.1.4-stable Forum).

The point is that the compiler range checkings are switched OFF when the ZEOS-source is compiled and the components are installed.
With that default installation some range problems do not come to the surface, even if range checking a activated in the application.

As a crosscheck, I added some ZEOS-source modules to my projects (to force compilation) and activated the compiler checkings.
The range violations are obvious now.
As I concentrate on the ORACLE part, maybe other modules/databases are also affected.

My proposal is to deliver (and test) the ZEOS project-sources with all checkings activated.

Best regards
Chris

ZEOS Version 7.1.4-Stable
ORACLE 11.2.0.1
Delphi 2010

Christoph Wiwie
http://www.wiwie.de
Certified Tester/ Certified Requirements Engineer
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Re: Range check error

Post by hemmingway »

-> My proposal is to deliver (and test) the ZEOS project-sources with all checkings activated.

This is the right way to deliver common sources. I have attached a patch for this problem.

Greetings, Bernhard
You do not have the required permissions to view the files attached to this post.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Range check error

Post by marsupilami »

Hello Bernhard,

while I agree that Zeoslib should be tested with range checks on and while I agree that it should work correctly with enabled range checks and not generate exceptions and errors, I have to disagree about the distribution. A lot of our users are not interested in testing Zeoslib. They want it to do its job as fast as possible without doing errors. So I assume that Zeoslib will continue to be delivered with range checks disabled. Everybody who wants the extra checks can quite easily enable them in the project filesWith best regards,

Jan
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Re: Range check error

Post by hemmingway »

Sorry,

I haven't made myself clear enough.

I mean
My proposal is to deliver (and test) the ZEOS project-sources are working with all checkings activated.

While project development I switched on all debug checkings. But ZEOS crashes with these settings. The solution is to fix the code or as workaround apply the patch.

Greetings, Bernhard
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Range check error

Post by marsupilami »

Hello Bernhard,

I spent some hours during the weekend to remove a lot of the range check errors. Please check the current SVN version for 7.2. One more hint: if you enable range checks ($R+) there is an {$ifopt $R-} in the Zeos.inc that you probably want to modify. Otherwise you might get additional Exceptions that are caused by a function that checks wether Field contents can be converted without loosing information.

Let me know what you think,

Jan
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Re: Range check error

Post by hemmingway »

Hello Jan,

the range check error in ZFunctions.pas ist fixed. :D
In ZDbcMySqlResultSet.pas the range check error is still present.
I cannot reproduce In ZVariant.pas the range check error at the moment.

For
FLengthArray[ColumnIndex{$IFNDEF GENERIC_INDEX}-1{$ENDIF}]
range check can not work.

FLengthArray is defined as
^TMySQLLengthArray;
TMySQLLengthArray = array[0..0] of Ulong;

A ColumnIndex greater than 0 fails.

Greetings, Bernhard
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Re: Range check error

Post by hemmingway »

Hello,

I think this is the best solution:

TMySQLLengthArray = array[0..999] of Ulong; //http://dev.mysql.com/doc/refman/4.1/en/ ... limit.html

Greetings, Bernhard
Post Reply