List:Internals« Previous MessageNext Message »
From:Joseph Lukas Date:July 5 2009 4:09pm
Subject:Re: Var_list quick question
View as plain text  
Thanks for the info. I think I assumed Lex was more of a linked list based
on MysQL's use of pointers for a lot of things and lack using the C++
features that I am used to. I also wanted to make sure as push_back I have
only seen in a vector for use. I am now reading up more on lists as I have
only really used vectors in basic reading I see why they are used. I also
had to make sure as I got confused as I knew I read somewhere to stay away
from STL features in c++ and the likes for MySQL code in one of the
tutorials. 

Joe

On 7/5/09 4:44 AM, "Sergei Golubchik" <serg@stripped> wrote:

> 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


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