Subject | Array Columns - as Parameters |
---|---|
Author | Geoff Worboys |
Post date | 2001-10-15T02:32:35Z |
Hi Jason,
I found (at least one of) my problems, I was trying to assign an array
from a Fields column to a Params column. With an array parameter the
ArrayDesc does not get defined. See this code...
constructor TIB_ColumnArray.Create( ARow: TIB_Row;
PSQLVAR: PXSQLVAR;
AFieldNo: smallint );
begin
inherited Create( ARow, PSQLVAR, AFieldNo );
FIsArray := true;
Statement.CheckTransaction( true );
if not IsAttributeSet[ IB_BINARY ] then
FPadChar := #32;
with Statement.IB_Session do begin
errcode := isc_array_lookup_bounds( @status,
Statement.pdbHandle,
Statement.ptrHandle,
PSQLVAR.RelName,
PSQLVAR.SQLName,
@FArrayDesc );
end;
end;
For parameter columns the PSQLVAR.RelName and PSQLVAR.SQLName values
are not defined, and even if they were there is no guarantee that the
parmeter name matches the field name.
I isolated the problem by putting in a check for (errcode <> 0). I
was going to suggest this be added BUT realised that that would
prevent the code from progressing and letting me manually assign the
ArrayDesc values later.
I have been able to work around the problem by manually copying the
ArrayDesc from the source field to the destination parameter before
performing the assignment. For my backup utility this seems safe
since I know that the two columns are declared identically.
I dont know if there is a better way to achieve this and I am not sure
if there is anything that can be done in IBO to avoid this requirement
for array parameters. If not then the restriction should be noted in
the documentation, perhaps it should be obvious but I did not realise
it.
Geoff Worboys
Telesis Computing
I found (at least one of) my problems, I was trying to assign an array
from a Fields column to a Params column. With an array parameter the
ArrayDesc does not get defined. See this code...
constructor TIB_ColumnArray.Create( ARow: TIB_Row;
PSQLVAR: PXSQLVAR;
AFieldNo: smallint );
begin
inherited Create( ARow, PSQLVAR, AFieldNo );
FIsArray := true;
Statement.CheckTransaction( true );
if not IsAttributeSet[ IB_BINARY ] then
FPadChar := #32;
with Statement.IB_Session do begin
errcode := isc_array_lookup_bounds( @status,
Statement.pdbHandle,
Statement.ptrHandle,
PSQLVAR.RelName,
PSQLVAR.SQLName,
@FArrayDesc );
end;
end;
For parameter columns the PSQLVAR.RelName and PSQLVAR.SQLName values
are not defined, and even if they were there is no guarantee that the
parmeter name matches the field name.
I isolated the problem by putting in a check for (errcode <> 0). I
was going to suggest this be added BUT realised that that would
prevent the code from progressing and letting me manually assign the
ArrayDesc values later.
I have been able to work around the problem by manually copying the
ArrayDesc from the source field to the destination parameter before
performing the assignment. For my backup utility this seems safe
since I know that the two columns are declared identically.
I dont know if there is a better way to achieve this and I am not sure
if there is anything that can be done in IBO to avoid this requirement
for array parameters. If not then the restriction should be noted in
the documentation, perhaps it should be obvious but I did not realise
it.
Geoff Worboys
Telesis Computing