Subject | TIB_Column.GetAsExtended and Int64 |
---|---|
Author | Guido Klapperich |
Post date | 2006-06-08T20:01:57Z |
I have a field of the type Numeric(18,0) with the value 12345678912345.
When I select the field, for example in a IB_edit control, all is fine,
the value is displayed. Now I define a display mask for the field like
###,###,###,###,###,##0
and I open my test query again, I get the exception that 12345678912345
is no integer value. I have done debugging and the problem is in the
unit IB_Components in the function TIB_Column.GetAsExtended: extended;
Here's the original code:
function TIB_Column.GetAsExtended: extended;
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
case SQLType of
SQL_FLOAT,
SQL_FLOAT_: Result := AsFloat;
SQL_DOUBLE,
SQL_DOUBLE_: Result := AsDouble;
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
end;
In my case the SQLType is SQL_INT64 and therefore the function runs into
Result := StrToInt( tmpS ) and then gets an error. I have added the
following code:
SQL_INT64,
SQL_INT64_: Result := AsInt64;
Now it works fine for me. Is this a bug I should report to Jason or am I
doing something wrong?
Regards
Guido
When I select the field, for example in a IB_edit control, all is fine,
the value is displayed. Now I define a display mask for the field like
###,###,###,###,###,##0
and I open my test query again, I get the exception that 12345678912345
is no integer value. I have done debugging and the problem is in the
unit IB_Components in the function TIB_Column.GetAsExtended: extended;
Here's the original code:
function TIB_Column.GetAsExtended: extended;
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
case SQLType of
SQL_FLOAT,
SQL_FLOAT_: Result := AsFloat;
SQL_DOUBLE,
SQL_DOUBLE_: Result := AsDouble;
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
end;
In my case the SQLType is SQL_INT64 and therefore the function runs into
Result := StrToInt( tmpS ) and then gets an error. I have added the
following code:
SQL_INT64,
SQL_INT64_: Result := AsInt64;
Now it works fine for me. Is this a bug I should report to Jason or am I
doing something wrong?
Regards
Guido