Subject Re: [ib-support] affected rows with c api
Author Paul Reeves
Geert Bevin wrote:
> Thanks for the link ... the code seems to work, but are there any
> details about what it does in the docs?

No, this is more or less undocumented.

> Since it seems to iterate of
> results and calculating deltas to obtain the final value. Why is it done
> this way?

If you look at the .h file you will see that there are private member
variables for the deltas and the current values. It just stores the
deltas from the previous operation, that's all.


> Why does it have to iterate?

It iterates because the result buffer is an array holding blocks of data
like this:

info type 1 byte
info block
...

Each block will store its size in the first two bytes and the contents
of the remainder of the block will depend upon the type of data.

If the info type is 'isc_info_sql_records' the data is stored like this

operation type 1 byte (update, delete etc).
operations 4 bytes (number of updates etc).

So, two sets of iterations are needed in order to unpack all the data.

You can see from the example link I gave you that the method in question
also detects the statement type. You can see the other possible values
that can be passed to isc_dsql_sql_info by looking at the appropriate
section of ibase.h. (Although I must confess I haven't tried any of the
others.)


Paul
--

Paul Reeves
http://www.ibphoenix.com
Supporting users of Firebird and InterBase