Board index » delphi » Execute batch file programmatically

Execute batch file programmatically

Hi,
I run IB Open Source 6.01 on Win98.
I want to execute batch file (DDL statements) from SQL components the same
way I do it from
ISQL.  I use "LoadFromFile" method to populate SQL property of TIBQuery
component.
But when I try to run the script it fails on the second statement, right
after ";".
In Interbase Documentation (Developer's Guide, Chapter 14  - working with
queries) I found:

"Interbase supports "batch" syntax so you can enter multiple statements in
the SQL property".

but there is no explanation how to do it or what "batch" syntax is.

Any ideas ?
Adam

 

Re:Execute batch file programmatically


Quote
"Adam" <akalin...@amano.com> wrote in message news:3bcefbca$1_2@dnews...
> Hi,
> I run IB Open Source 6.01 on Win98.
> I want to execute batch file (DDL statements) from SQL components the same
> way I do it from
> ISQL.  I use "LoadFromFile" method to populate SQL property of TIBQuery
> component.
> But when I try to run the script it fails on the second statement, right
> after ";".
> In Interbase Documentation (Developer's Guide, Chapter 14  - working with
> queries) I found:

At present, the TIBQuery and TIBSQL do not support multiple commands.
However, Jeff is working on this to be implemented in the next version, I
believe. He can correct me if I'm wrong, but I believe I've seen several
posts from him about it.

Woody

Re:Execute batch file programmatically


As an addition, you can check out Jason Wharton's IBObjects components. I
believe he has already implemented this functionality but I could be wrong.

Woody

Re:Execute batch file programmatically


Thanks Woody,

Is there any "workaround" ?
What would you do if you need to execute a batch SQL file from Delphi?
Adam

Quote
"Woody" <woody....@ih2000.net> wrote in message news:3bcf1d1c_1@dnews...
> As an addition, you can check out Jason Wharton's IBObjects components. I
> believe he has already implemented this functionality but I could be
wrong.

> Woody

Re:Execute batch file programmatically


Quote
"Adam" <akalin...@amano.com> wrote in message news:3bcf2029$1_2@dnews...
> Thanks Woody,

> Is there any "workaround" ?
> What would you do if you need to execute a batch SQL file from Delphi?
> Adam

My memory is failing. I should have also mentioned that it would be wise to
commit each one. There are some DDL commands that don't recognize previous
ones that aren't committed even though they are in the same transaction. I
ran into this a while back writing a few update routines for some tables and
procedures. I don't remember what they are right now but someone else might.

Woody

Re:Execute batch file programmatically


Quote
"Adam" <akalin...@amano.com> wrote in message news:3bcf2029$1_2@dnews...
> Thanks Woody,

> Is there any "workaround" ?
> What would you do if you need to execute a batch SQL file from Delphi?
> Adam

Read each query in and execute it, then read the next one until you're done.

Woody

Re:Execute batch file programmatically


Quote
Woody wrote:
> As an addition, you can check out Jason Wharton's IBObjects components. I
> believe he has already implemented this functionality but I could be wrong.

Use the script component to run several SQL statements (separated by
semicolon).  It works like the script page of the IB_SQL tool (free
download from www.ibobjects.com).

Regards,
Aage J.

Other Threads