Many SQL clauses executing

Many SQL clauses executing

am 04.04.2005 15:57:29 von Nicolay Vasiliev

Hello there!

I tried to execute many SQL-clauses ";" separated by DBI::do() method
but got an error message about SQL syntax mistake. If I execute the same
SQL from MySQL shell or some MySQL GUI all works fine. Is DBI::do()
method able to perform many SQL clauses at all? If no what method or
function should I use to perform this?


Thanks in advance.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

RE: Many SQL clauses executing

am 04.04.2005 16:06:34 von Bob Showalter

Nicolay Vasiliev wrote:
> Hello there!
>
> I tried to execute many SQL-clauses ";" separated by DBI::do() method
> but got an error message about SQL syntax mistake.

You must execute statements one at a time with do(). Don't add semicolons at
the end.

> If I execute the
> same SQL from MySQL shell or some MySQL GUI all works fine.

Those tools are internally splitting the script into separate statements and
executing them on at a time. When you use DBI, you have to do this splitting
yourself.

> Is
> DBI::do() method able to perform many SQL clauses at all? If no what
> method or function should I use to perform this?

There is a DBI::Shell module on CPAN you might want to look at. I have not
used it myself, so I can't comment on how well it works...

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

Re: Many SQL clauses executing

am 05.04.2005 00:17:57 von Daniel Kasak

Nicolay Vasiliev wrote:

> Hello there!
>
> I tried to execute many SQL-clauses ";" separated by DBI::do() method
> but got an error message about SQL syntax mistake. If I execute the
> same SQL from MySQL shell or some MySQL GUI all works fine. Is
> DBI::do() method able to perform many SQL clauses at all? If no what
> method or function should I use to perform this?

Current stable versions of MySQL don't support multiple statements in
this way.
I believe support for this will be added in 5.x, but it *could* be in
4.1.x. Either way, you won't be able to do it for a while.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@nusconsulting.com.au
website: http://www.nusconsulting.com.au

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org