List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 23 2005 7:12pm
Subject:Re: User Variables
View as plain text  
At 22:04 -0700 4/22/05, Ed Reed wrote:
>Thanks for the reply,
>
>So is there anyway to use User Variables with a single connection. 
>All my apps are in VB6 and VBA. They all take a query, open a 
>connection, run query, fill array from query results, close 
>connection and pass back the array. Because of backward 
>compatibility there's no way I can change them to do otherwise.

User variables disappear when the connection closes.


>
>Thanks again.
>
>>>>  Chris <listschris@stripped> 04/22/05 7:56 PM >>>
>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
>
>--
>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


-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
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