Page 1 of 1

Range check error

Posted: 03.02.2015, 13:46
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

Re: Range check error

Posted: 06.03.2015, 22:01
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

Re: Range check error

Posted: 28.03.2016, 11:56
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

Re: Range check error

Posted: 28.03.2016, 17:09
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

Re: Range check error

Posted: 31.03.2016, 09:28
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

Re: Range check error

Posted: 31.03.2016, 10:09
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

Re: Range check error

Posted: 31.03.2016, 17:51
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

Re: Range check error

Posted: 03.04.2016, 15:23
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