FIBPlus, Interbase and array fields 
Author Message
 FIBPlus, Interbase and array fields

Hello there,

I'm writing because there's something that I'have not a clue on...
I've searched for this topic on newsgroups, but it looks like nobody
got this... I'm running delphi 4 with FIBPlus against Interbase 6 for
Linux with TCP/IP connection...

I have huge table with a lot of fields in it... Some of them are
arrays defined as follows:

CREATE TABLE CASE (
        /* .... Lots of field here ....*/

        DISTANZA_CITTA VARCHAR(64)[1:6],
        DISTANZA_CITTA_KM SMALLINT[1:6],

        /* .... Lots of field here ....*/
);

No problems in reading the table with the TFibQuery component, but...
When it comes to updating a record, using params I got a strange
behaviour... This is the SQL property for the FibQuery component:

UPDATE CASE SET
        /* other fields here ... */
        DISTANZA_CITTA = :DISTANZA_CITTA,
        DISTANZA_CITTA_KM = :DISTANZA_CITTA_KM,
        /* ... other fields here */
WHERE ID = :ID

The thing is that, for some reasons, I have to re-read the value from
the param property after the assignment... Take a look at this code:

procedure Test;
var
  aVarVal : Variant;
  sFieldName : string;

begin

  sFieldName := 'DISTANZA_CITTA';

  aVarVal := VarArrayCreate([1, 6], varVariant);
  aVarVal[1] := 'First string';
  aVarVal[2] := 'Second string';
  { ... }
  aVarVal[6] := 'Last string';

  { assigns it to the parameter }
  Query.ParamByName(sFieldName).AsVariant := aVarVal;

  { tries to re-read the value assigned with the previous line }
  aVarVal := Query.ParamByName(sFieldName).asVariant;

  { Here aVarVal is null and the next line raises and exception }
  ShowMessage(VarToStr(aVar[1]));

end;

Am I doing something wrong?? Is there a different way to assign array
values to parameters?? Everything is fine working with other field
types, like VARCHAR, INTEGER and so on... Only arrays can't be
re-read...

I hope someone can help me...

Thanks in advance,
Guido.



Sat, 14 Feb 2004 18:12:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help! Interbase array fields

2. Help: Accessing Interbase array fields in dbgrid

3. Array field in Interbase

4. Interbase Array Fields

5. Array fields with Interbase and TFibQuery

6. move INTERBASE ARRAY to DELPHI ARRAY ?

7. FIBPlus 4.5.1 is available on http://www.fibplus.net!

8. Devrace FIBPlus 4.7 has been published

9. Devrace FIBPlus 4.77 is available

10. Saving TMemo field data to a Blob field (Interbase Table) via SQL Update Query

11. Acessing Interbase-Array from delphi

12. Accessing Interbase - Array's from Delphi

 

 
Powered by phpBB® Forum Software