Question: I want to write arrays into an InterBase table. Why doesn't the following code work?

pFIBQuery1->>SQL->Add("INSERT INTO T(A) VALUES(:A)");
pFIBQuery1->>pFIBQuery1->PrepareArrayFields();
pFIBQuery1->>ParamByName("A")->SetArrayValue( A );

Answer: You should use the PrepareArraySqlVar instead of PrepareArrayFields. PrepareArrayFields works with the array fields, and you do not have any array fields in your code. The PrepareArraySqlVar method works with parameters and informs the library which table and field your parameter refers to. So the correct code should be:

pFIBQuery1->>SQL->Add("INSERT INTO T(A) VALUES(:A)");
pFIBQuery1->>pFIBQuery1->PrepareArrayFields();
pFIBQuery1->>PrepareArraySqlVar(pFIBQuery1->ParamByName("A"),"T","A",False);
pFIBQuery1->>ParamByName("A")->SetArrayValue( A );


Preview text: 
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...

Navigation



Coming from a Java/OO background, it has been a real pleasure working with FIBPlus in Delphi.  I'm very picky about good code design, and FIBPlus has it in spades! >>

Nathan Probst, Co-Founder Kazoie LLC
FOR CUSTOMERS
Download full versions and updates in your Personal Area