List:Internals« Previous MessageNext Message »
From:Eric Prud'hommeaux Date:April 10 2006 11:44pm
Subject:Re: getting table meta data (primary key, in this case)
View as plain text  
On Mon, Apr 10, 2006 at 12:56:15PM -0400, Eric Prud'hommeaux wrote:
> On Mon, Apr 10, 2006 at 04:54:38PM +0200, Sergei Golubchik wrote:
> > Hi!
> > 
> > First: please don't forget to cc: your questions to the list,
> > so that others could benefit from the knowlegde share too.
> > Also you can get faster replies, because more developers will see your
> > question and will have their chance to answer.
> 
> Yep. mistake there.
> 
> > > Also, while i'm strolling around MySQL in gdb, are there any
> > > toString-like methods to give a string representation of an
> > > expression complile tree ala :?
> > >   p sel->where->as_string()
> > 
> >   Item::print()
> > 
> > Though it uses String class, so I'm not sure you can call it from gdb
> > the way you want. You can try the following workaround:
> > 
> >   String gdb_print_buf;
> >   char *Item::gdb_print()
> >   {
> >     print(&gdb_print_buf);
> >     return gdb_print_buf.c_ptr();
> >   }
> 
> Excellent! stuck this in a header:
>   extern String Global_string; // call test->print(&Global_string); p
> Global_string.c_ptr(); call Global_string.free()
> 
> this in a .cc file:
>   String Global_string;
> 
> and can call it repeatedly from gdb like so:
>   (gdb) call test->print(&Global_string)
>   (gdb) p Global_string.c_ptr()
>   $11 = 0x8df42a8 "(`Orders_0`.`id` = 2186)"
>   (gdb) call Global_string.free()
> where test is some Item.

used gdb's define command to create a shortcut function:
(gdb) define pr
>call $arg0->print(&Global_string)
>p Global_string.c_ptr()
>call Global_string.free()
>end

and tried it out:
(gdb) pr(s)
$19 = 0x8df4868 "`Orders_0`.`id`{?o}"


> > Regards,
> > Sergei
> > 
> 



-- 
-eric

office: +81.466.49.1170 W3C, Keio Research Institute at SFC,
                        Shonan Fujisawa Campus, Keio University,
                        5322 Endo, Fujisawa, Kanagawa 252-8520
                        JAPAN
        +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
cell:   +81.90.6533.3882

(eric@stripped)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Attachment: [application/pgp-signature] Digital signature signature.asc
Thread
getting table meta data (primary key, in this case)Eric Prud'hommeaux1 Apr
  • Re: getting table meta data (primary key, in this case)SGreen3 Apr
    • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux3 Apr
      • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux5 Apr
        • RE: getting table meta data (primary key, in this case)Rick James5 Apr
          • RE: getting table meta data (primary key, in this case)Stewart Smith6 Apr
          • RE: getting table meta data (primary key, in this case)Stewart Smith6 Apr
        • Re: getting table meta data (primary key, in this case)Sergei Golubchik6 Apr
          • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux6 Apr
            • Re: getting table meta data (primary key, in this case)Sergei Golubchik10 Apr
              • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux15 Apr
                • Re: getting table meta data (primary key, in this case)Sergei Golubchik18 Apr
                • Re: getting table meta data (primary key, in this case)Sanja Byelkin18 Apr
  • Re: getting table meta data (primary key, in this case)Sergei Golubchik3 Apr
Re: getting table meta data (primary key, in this case)Sergei Golubchik10 Apr
  • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux10 Apr
    • Re: getting table meta data (primary key, in this case)Eric Prud'hommeaux11 Apr