List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 21 1999 12:07pm
Subject:adding variables to 'mysql' program
View as plain text  
>>>>> "Thimble" == Thimble Smith <tim@stripped> writes:

Thimble> Hi.  I've got an idea that it would be nice (and not too hard) to
Thimble> add some notion of variables to the 'mysql' program.  Then some
Thimble> operations that have to be done in >2 queries would be a whole
Thimble> lot easier to perform.  It would obviate the need for writing a
Thimble> throw-away script for one-time database fixes.

Thimble> For example, I do one query that returns a list of IDs, and another
Thimble> query to DELETE FROM table WHERE table_id IN (${stored list of ids}).

Thimble> I know that sub-selects will make this example obselete, but does
Thimble> something like this sound like a good idea?  Does anyone have good
Thimble> ideas about the syntax to use?  If there is enough interest (and I
Thimble> can figure out a good way to do it), I'll try to implement it (no
Thimble> guarantees on time, though, 'cause <insert your favorite excuse>).

Thimble> Tim


Yes, this could be good idea (even if you have sub selects). The
problem is what syntax to use for variables to distinguish them from
column/table names.

Tim,  You can simply implement this by adding a hashed variable name
list in the THD structure and some small modifications to:

- sql/   ; To parse variable names.
- sql/sql_yacc.yy  ; To convert a variable name to an Item
- sql/	   ; Create an item to access variable names
- sql/item.h	   ; Prototype for the Item_varible 


adding variables to 'mysql' programThimble Smith19 Mar
  • adding variables to 'mysql' programMichael Widenius21 Mar