Subject | TIB_ColumnInteger.SetAsString is blocking exceptions from being raised |
---|---|
Author | geraldo_ls |
Post date | 2002-11-21T11:09:33Z |
Hi,
I started to use IBO 4 and think I encountered a bug. I wrote an
TIB_Query.OnValidateField to validate an Integer field. Delphi was
stopping on language exceptions, so the exception that my code raised
was intercepted by delphi, but when I pressed F9 the exception was
not presented to the user.
I followed the code and discovered that the following piece of
TIB_ColumnInteger.SetAsString is blocking exceptions from being
raised:
procedure TIB_ColumnInteger.SetAsString( const NewValue: string );
var
tmpVal: string;
begin
.
.
.
try
Value := StrToInt( tmpVal );
except
// In Delphi 3 it doesn't seem to know how to reciprocate the
value.
if IntToStr( Low( integer )) = tmpVal then
Value := Low( integer );
end;
end;
Note that the try except block doesn't re-raise the exception.
I've looked at TIB_ColumnNumeric.SetAsString methods in the
IBA_Column.IMP and It has a try except block this way :
try
assign the value
except
on This:
Manage;
on That;
Manage
else raise;
end;
I've looked TIB_ColumnInteger.SetAsString in IBO 3.6 and the code
doesn't have the "try except without raise" :
procedure TIB_ColumnInteger.SetAsString( const NewValue: string );
var
tmpVal: string;
begin
tmpVal := NewValue;
if Assigned( FOnSetText ) then
FOnSetText( Self, tmpVal );
tmpVal := Trim( tmpVal );
if ( Length( tmpVal ) = 0 ) then
begin
if IsNullable or (( Row.RowType = rtField ) and FBlankIsNull )
then
Clear
else
Value := 0;
end
else
Value := StrToInt( tmpVal );
end;
Thanks in advance and sorry my english.
Geraldo Lopes de Souza
I started to use IBO 4 and think I encountered a bug. I wrote an
TIB_Query.OnValidateField to validate an Integer field. Delphi was
stopping on language exceptions, so the exception that my code raised
was intercepted by delphi, but when I pressed F9 the exception was
not presented to the user.
I followed the code and discovered that the following piece of
TIB_ColumnInteger.SetAsString is blocking exceptions from being
raised:
procedure TIB_ColumnInteger.SetAsString( const NewValue: string );
var
tmpVal: string;
begin
.
.
.
try
Value := StrToInt( tmpVal );
except
// In Delphi 3 it doesn't seem to know how to reciprocate the
value.
if IntToStr( Low( integer )) = tmpVal then
Value := Low( integer );
end;
end;
Note that the try except block doesn't re-raise the exception.
I've looked at TIB_ColumnNumeric.SetAsString methods in the
IBA_Column.IMP and It has a try except block this way :
try
assign the value
except
on This:
Manage;
on That;
Manage
else raise;
end;
I've looked TIB_ColumnInteger.SetAsString in IBO 3.6 and the code
doesn't have the "try except without raise" :
procedure TIB_ColumnInteger.SetAsString( const NewValue: string );
var
tmpVal: string;
begin
tmpVal := NewValue;
if Assigned( FOnSetText ) then
FOnSetText( Self, tmpVal );
tmpVal := Trim( tmpVal );
if ( Length( tmpVal ) = 0 ) then
begin
if IsNullable or (( Row.RowType = rtField ) and FBlankIsNull )
then
Clear
else
Value := 0;
end
else
Value := StrToInt( tmpVal );
end;
Thanks in advance and sorry my english.
Geraldo Lopes de Souza