List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:July 5 2009 10:44am
Subject:Re: Var_list quick question
View as plain text  
Hi, Joseph!

> As implementation I figured since the Lex is essentially a linked list
> I would traverse the Lex until the Select statements are reached and
> break the linked list. I would then make a List(Set Linked List) and
> call the set functions like it is doen normally.  I would then find
> the Select functions and send to them. I figure during while
> traversing the Set statement I could copy the chain of variables that
> are to be Set this way before I send to the SET function I could
> retrieve the variables for GET to reset the values after I perform the
> SELECT. Does this sound logical or am I off in how the Lex is setup?

I'm confused. Where did you see that Lex is a linked list ?
SET stores variables in  the Lex->var_list, that is in a list inside one
Lex, not in a list of Lex'es.

> I will finally start on the traversing the Lex today after I take care
> of a few chores. If you could point me into how to start the at the
> first item and pointer type would be helpful and save time.  Is there
> are pointer *start -> item or no in the YYTHD

Traversing the Lex->var_list ? If yes - see below.

> Just a quick question is Lex->var_list a vector? As I see it uses
> .empty() and push_back . If that is the case I can go through it
> pretty quickly I think.  Although given everything is pretty much
> linked lists used in mysql I would have thought it was a bunch of
> pointers in a linked list style.  (even though a vector is likely a
> specialized linked list anyways being dynamic in size)

It's not an std::vector, if that's what you mean. MySQL doesn't use STL.
Lex->var_list is defined as

    List<set_var_base>  var_list;

and to iterate the list you use the following:

   List_iterator_fast<set_var_base> it(*Lex->var_list);
   set_var_base *var;
   while ((var=it++))
   {
     ... do something with 'var' ...
   }

see sql_set_variables() for an example.

Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   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
Thread
Var_list quick questionJoseph Lukas4 Jul
  • Re: Var_list quick questionSergei Golubchik5 Jul
    • Re: Var_list quick questionJoseph Lukas5 Jul
      • Re: Var_list quick questionJay Pipes5 Jul