Subject Re: [Firebird-Java] TPB getAttribute neither as int or String!
Author Roman Rokytskyy
> I've been trying to understand TransactionParameterBuffer, so I simply
> tried to print out its contents (btw, it would be VERY nice to be able to
> do this without getting every parameter - is there a reason why
> getArgumentsList() is private?).

Nobody needed it before. :)

> however, I can't seem to get some of the attributes, either as an int or
> as a String, the only 2 methods available. eg

Probably I have chosen wrong method names - in fact there are three methods
to get value as

a) int - getArgumentAsInt
b) String - getArgumentAsString
c) boolean - hasArgument

Last method does not throw exception also for int and String attributes, but
the rest of the behavior is correct - you cannot get boolean attribute as
int or as String.

> Also, can someone explain how I set different attributes, and which ones
> need which addArgument(...) method? I couldn't find it anywhere in the
> docs or in the source.

In general it corresponds to the definition in InterBase 6.0 API Guide
(currently the only documentation).

- addArgument(int) - for booleans (in API Guide described with length 1 and
value ignored);

- addArgment(int, int) - for integers (not applicable for TPBs, copied from
the DPB)

- addArgument(int, String) - for strings (for TPBs needed only for table
reservation, but also same method used for DPBs)

- addArgument(int, byte[]) - set byte data to send over the wire directly
(use only if you know what you're doing).

> txSettings.addArgument(TransactionParameterBuffer.CONSISTENCY);
>
> but then couldn't read it as either Int or String.

You were not supposed to read it. I hardly can imagine application that
needs to access the data DPB or TPB that was set in other part of the
application. But since you've asked, I think we have to add this feature.

> This is very confusing!

Thanks for the report - we will extend the interface to allow also reading
without confusing too much :-)

Roman