Board index » delphi » Array fields with Interbase and TFibQuery

Array fields with Interbase and TFibQuery

Hi everybody,

I know that FIBPlus supports array fields, although I tried many
different ways to use the with TFibQuery I haven't a clue for this...

I am trying to set the value of an array field of integers whose
values are stored at runtime in a TStringGrid... Everytime I try to
set the value of the param for field composizione I get an exception
that reports 'Column types "."' is not array field'

This is the medatdata for the table:

CREATE TABLE "ART" (
       "ID" INTEGER NOT NULL,
       "IDCATEG" INTEGER,
       "CODICE" VARCHAR(32) NOT NULL,
       "COMPOSIZIONE" INTEGER[1:20]
);

What's wrong with this code??

  ArtQry.SQL.Text := 'UPDATE ART SET IDCATEG=:IDCATEG, CODICE=:CODICE,
COMPOSIZIONE=:COMPOSIZIONE WHERE ID=:nCurArt';

  ArtQry.ParamByName('nCurArt').AsInteger := nCurArt;
  ArtQry.ParamByName('IDCATEG').AsString := EdCateg.Value;
  ArtQry.ParamByName('CODICE').AsString := EdCodice.Text;

  aComp := VarArrayCreate([1, N_MAX_COMPOSIZIONE], varInteger);
  for i := 1 to N_MAX_COMPOSIZIONE do
  begin
        aComp[i] := CompGrid.Cells[1, i - 1];
  end;

  ArtQry.ParamByName('COMPOSIZIONE').SetArrayValue(aComp);

  ArtQry.Prepare;
  ArtQry.ExecQuery;

Thanks everybody in advance for the help...

Guido.

 

Re:Array fields with Interbase and TFibQuery


Quote
2102b...@katamail.com (Guido Pietrella) wrote:
> What's wrong with this code??

I don't know what's wrong with the code, but is there a reason that
you absolutely *_have_* to use arrays?

Can you not create another table and use a PK - FK relationship
between them?

I say this because many people on the Borland newsgroups whose opinion
I respect avoid them like the plague - anyway, it's completely against
the relational model.

Paul...

Quote
> Guido.

--
Paul Linehan

plinehan at yahoo dot com/linehanp at tcd dot ie

I drink to keep body and
soul apart - O. Wilde.

"Mens sana in campari soda" - anon.

Other Threads