Subject Re: [IBO] Nothing resolved about bigint problem
Author Helen Borrie
Goran,

At 09:28 AM 23/02/2004 +0000, you wrote:
>Hi,
>
>last month I post a problem with FB1.5RC8 + IBO 4.3Aa + DBLookupCombo
> on D7 + WIN2000/WINXP .

I'm on D6 and Win2K, same IBO version.

>It gives an error when I try to replace bigint data field from bigint
>lookup field ( the one I choose ).Error is :
>
>"Cannot access field ID_Lookup as type Variant."

I can't reproduce this error. I can add a new row to any of the structures
and it works, although I would expect it to produce an error, because of this:

procedure TDataMod.GenIdAfterInsert(DataSet: TDataSet);
begin
(DataSet as TIBOQuery).FieldByName('ID').AsFloat :=
dbTEST.Gen_ID('GEN_IDENT', 1);
end;

Reason: generators are BigInt, not Float. AsInteger will properly handle
the BigInt type, by the way. So possibly you are seeing the exception you
report because of this.

In any case, this is the hard way to do this. All you really need is to
populate the GeneratorLinks property of the TIBODatabase as follows:

MASTER_TABLE.ID=GEN_IDENT
DETAIL_TABLE=GEN_IDENT
LOOKUP_TABLE=GEN_IDENT

and drop that wrong procedure altogether.


>ID_Lookup is bigint field that need to be changed from DBLookup Combo.

In fact, the lookup relationship doesn't work at all in this sample. It
works in the "wrong" direction, i.e. if I type a valid lookup_table ID into
to ID_Lookup field, it does it fine and properly locates the matching
record in the lookup list.

Another problem I found was that you had the ib_transaction property of
that lookup dataset set to <default>, whereas everything else in the
datamodule was using your explicit transaction trTest. That meant that the
datasets were opened in different transactions.


>Under the files section I have put the source example
>named "test_BIGINT_ERROR.rar" . It is very simple and shows the
>error. Just unrar it into subdir "D:\test" and it's ready to go.
>
>I think that this is huge problem , because this kind of stuff (
>having bigint as identifier but not able to work with it via
>LookupCombo ) is essential in programs .

Of course! but casting a 64-bit integer as a float won't help. :-)
If there were really a problem with it, nobody would be able to use Fb with
Delphi - but hundreds of thousands of people do.


>Interesting is that same example works OK if I use Integer field
>instead.

Don't confuse an integer "field" (do you mean "column"? or a Delphi field
object?) with AsInteger. Delphi will correctly cast a 64-bit integer type
if you use AsInteger.


>Can someone just take a look at example to see if I put everything OK
>( I'm new with IBO ) and to confirm is that IBO problem or something
>else.

Since I can't reproduce the problem you describe, I can't "fix" it. But
would you try the repairs I suggested and see whether that makes a
difference on your setup.

Meanwhile, I'll try to work out why it is that your lookup relationship is
working "backwards" here. I'll report anything else I find.

Helen