On Sun, Aug 26, 2001 at 09:38:55PM +0100, Tim Bunce wrote:
> >
> > So what I don't understand is what how bind_columns is dereferencing this in
> > such a manner as to allow me to refer to the columns as scalars WITHOUT
> > showing seeming to show any overhead.
>
> The magic of aliasing. Watch:
>
> # create the row buffer (done once at prepare/execute time)
> $row_field_array = [];
>
> # bind a column of the row buffer to a scalar variable
> *bind_column_value = \$row_field_buffer->[4];
>
> # fetch the fields of the current row
> foreach (0..9) {
> $row_field_buffer->[$_] = $_ * 100;
> }
>
> print "$bind_column_value\n";
>
> Run it and it prints 400. Magic.
Just to clarify this, I should add that after the aliasing then
$bind_column_value and $row_field_buffer->[4] are *the same variable*.
There's no copying involved.
Tim.