List:General Discussion« Previous MessageNext Message »
From:SGreen Date:March 23 2005 4:53pm
Subject:RE: semicolon commands causing problems
View as plain text  
Normally, MySQL queries DO NOT end in a semicolon. The semicolon (;) and 
the \G terminators are used by the command line client  to differentiate 
between normal (wide output) and vertical output.  I have also used 
semicolons in SQL scripts loaded by the "source" command to be processed 
through the command line client but I haven't tried to use the \G 
terminator so I don't know if it works in that context. In this case the 
command line client processes each statement of my script, in turn, just 
as though I had typed (or pasted) them into the interface.

I do not know ANT at all so I can't say how each ANT command/statement is 
to be terminated. But, if you are executing SQL commands through an ANT 
connection to the database, I think you will need to send (execute, 
process, whatever the verb is in ANT...) your SQL statements one at a time 
as your connection library is most likely unable to handle the multiple 
results that would occur if you tried to execute several statements at 
once. Each SQL statement should probably NOT end with a semicolon.

There is a convention on this list to end each statement with a semicolon 
or a \G. That is because we are assuming that everyone has at least the 
MySQL command line client and we are usually writing our scripts or 
statements for that interface. If you are using a different interface 
(such as an ANT to MySQL connection library), you need to abide by the 
rules of that interface and port our examples accordingly.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


"Justin Moore" <JMoore@stripped> wrote on 03/23/2005 11:04:40 AM:

> I forgot to mention that it is happening from my ant scripts too. 
> So the problem is occurring outside of the query browser as well. 
> However, from the command line I can execute the two statements. 
> 
> Any ideas what could be causing this?
> 
> -----Original Message-----
> From: Justin Moore 
> Sent: Wednesday, March 23, 2005 10:39 AM
> To: mysql@stripped
> Subject: semicolon commands causing problems
> 
> 
> Hi, 
> 
> Anyone know why I can't run multiple commands from the query browser
> using semicolons to separate the commands?
> 
> ex:
> The following command works fine:
> select now();
> 
> 
> However the following commands do not
> select now();
> select version();
> 
> 
> Your help is appreciated,
> 
> -JM
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 

Thread
semicolon commands causing problemsJustin Moore23 Mar
  • Re: semicolon commands causing problemsSGreen23 Mar
RE: semicolon commands causing problemsJustin Moore23 Mar
  • RE: semicolon commands causing problemsSGreen23 Mar
  • Re: semicolon commands causing problemsUsha24 Mar
    • how to rollback in MySql?Digvijoy Chatterjee24 Mar
Re: how to rollback in MySql?Martijn Tonies24 Mar