List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:May 15 2009 12:19pm
Subject:Re: Question on parser and variable
View as plain text  
Hi, Joseph!

On May 14, Joseph Lukas wrote:
> So far I have the parser looking at mysql_set_variable as a SELECT
> <option> and it can make it past the parser so long as you do not use
> a *. 
> I was going to ask if I could move the command out in front of the
> select as it seems to get confusing with the select terms.  Such as
> MYSQL_SET_VARIABLE sort_buffer_size=100000 SELECT * FROM test;
> I like version 2 better it just looks simpler and better defined with less
> chances for user error. Yes/no

Actually, the specs in WL#681 have four different syntax variants.
What you started implementing is #1, what you want to switch to is #3.

I'll describe #3 again. The syntax is:

  SET STATEMENT sort_buffer_size=100000 SELECT * FROM test;

which vaguely resembles

  SET GLOBAL sort_buffer_size=100000;

  SET SESSION sort_buffer_size=100000;

so it's not completely new for MySQL users.
Note also:

* more than one variable can be set:

  SET STATEMENT sort_buffer_size=100000, record_buffer=10000 SELECT * FROM test;

* for the compound statement:

  SET STATEMENT sort_buffer_size=100000 BEGIN SELECT * FROM test; END

  the new value is set till the END of the compound statement.

* the statement is completely parsed first, then executed. that is


  won't work.

Regards / Mit vielen Grüßen,

   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
Question on parser and variableJoseph Lukas14 May
  • Re: Question on parser and variableSergei Golubchik15 May