List:General Discussion« Previous MessageNext Message »
From:Chris Date:April 23 2005 2:56am
Subject:Re: User Variables
View as plain text  
Ed Reed wrote:

>If I run the following in MySQLFront v3.1
> 
>Set @A='Test';
>Select @A;
>
>I get back same result
> 
>+------+
>| @A   |
>+------+
>| Test |
>+------+
>
>If I run the same query in MySQL Query Browser v1.1.6 I get this,
> 
>ErrNo 1060,  You have an error in your SQL syntax; check the manual that corresponds
> to your MySQL server version for the right syntax to use near ';
>select @A' at line 1
> 
>and If I run the same query in my application I get the same error as the Query
> Browser.
> 
>Anyone know how I can get my application to give me what I'm looking for?
> 
>  
>
The command line interface allows you to run multiple commands at once. 
The Query Browser and PHP interfaces allow only one query per function 
call. So mysql_query('SET @A; SELECT @A;') would fail. You need to run 
each query separately.

This is certainly the case in your application, even if it's not PHP.

If you ran the queries separately in the Query Browser, you wouldn't get 
the results you expect. It would forget the value of @A because it 
closes the connection each time. It's possible to keep the connection 
open by Starting a transaction (even if you're using MyISAM tables).

Chris
Thread
User VariablesEd Reed23 Apr
  • Re: User VariablesChris23 Apr
Re: User VariablesEd Reed23 Apr
  • Re: User VariablesChris23 Apr
  • Re: User VariablesPaul DuBois23 Apr
Re: User VariablesEd Reed23 Apr
Re: User VariablesEd Reed25 Apr
  • Re: User VariablesSGreen25 Apr