Subject Re: [IBO] TIB_DSQL - more than one SQL statement possible?
Author Helen Borrie
At 10:11 AM 17/05/2005 +0200, you wrote:
>Hi,
>I'm trying to optimize my application in some aspects and I want to
>combine several SQL statements into one sql.
>But I'm doing something wrong, as the OnPrepare Event is giving
>me errors "unknown token" on the second command.
>Here's the IB_DSQL.sql.commatext before I try to load the params:
>
>"update lagerkarte set bestand = bestand+:Deltabestand,
>ANZAHL_AENDERUNGEN=ANZAHL_AENDERUNGEN+1 where
>ref=:ref;","insert into Artikelhistorie
>(Buchungstext,Mengenaenderung,MengenachAenderung,
>Buchungdurch,Zeitstempel,Buchungstyp,BelegNr,einzelpreis,Ref0,A
>dressNr,Kurzname)
>values","(:Buchungstext,:Mengenaenderung,:MengenachAenderung,
>:Buchungdurch,:Zeit,:Typ,:BelegNr,:EPreis,:Ref0,:AdrNr,:Kurzname);
>"
>
>So it's basically an update statement followed by an insert.
>Or do I have to use special sql termination chars to separate the two
>statements?
>Or is it a limitation of TIB_DSQL of accepting only one statement per
>execution?

Well, yes :-)

A TIB_Statement implements *one statement*, not multiple. If you want to
use a component that executes multiple statements, one after another, you
need a script. IBO has TIB_Script for this.

Helen