List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:June 6 2008 4:53am
Subject:Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)
WL#4398
View as plain text  
Hi Mats

I my previous mail, there is mistake, see below.

On 2008-06-06 Fri 12:35 +0800, He Zhenxing wrote:
> Hi Mats
> 
> Did you noticed that I included <my_global.h> in plugin.h? 
> 
> The functions I added in plugin.h used some typedefs defined 
> in it, such as uint32, uchar. I am not quite sure other stuffs defined
> in my_global.h should be exported or not.
> 
> See below.
> 

[snip]

> > > +  user_var_entry *entry=
> > > +    (user_var_entry*)
> hash_search(&mysql_thd_to_thd(thd)->user_vars,
> > (uchar*) name,
> > > +                                  strlen(name));
> > > +  if (entry)
> > > +  {
> > > +    entry->val_str(null_value, &str, precision);
> > > +    strncpy(value, str.c_ptr(), len);
> > > +  }
> > > +  else
> > > +  {
> > > +    *value= 0;
> > > +  }
> > > +  return 0;
> > > +}
> > 
> > I would suggest to return an error code from the function if the
> > variable is not found. Otherwise, it is impossible to distinguish
> > between a variable that exists but is the empty string, and a variable
> > that does not exist.
> 
> Actually the out parameter `null_value' is used for this purpose, maybe
> I should change this to use the return value as an indicator of if the
> variable is defined (return 0 on success, 1 if variable not found). and
> remove `null_value' parameter.
> 
> int get_user_var_int(MYSQL_THD thd, const char *name, longlong *value);
> int get_user_var_real(MYSQL_THD thd, const char *name, double *value);
> int get_user_var_str(MYSQL_THD thd, const char *name,
> 		     char *value, size_t len, uint precision);

I misinterpretated the out parameter `null_value', it is used to
indicate that the value is NULL, not the variable is not defined. So
this parameter should not be removed.


Thread
bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398He Zhenxing5 Jun
  • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Mats Kindahl5 Jun
    • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398He Zhenxing6 Jun
      • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398He Zhenxing6 Jun
      • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Mats Kindahl9 Jun
        • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Sergei Golubchik9 Jun
          • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Mats Kindahl9 Jun
            • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398He Zhenxing10 Jun
          • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398He Zhenxing10 Jun
            • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398Sergei Golubchik10 Jun
              • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635)WL#4398He Zhenxing10 Jun
            • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Mats Kindahl10 Jun
              • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree(hezx:2635) WL#4398He Zhenxing10 Jun
                • Re: bzr commit into mysql-6.0-semi-sync-1.0 tree (hezx:2635) WL#4398Mats Kindahl10 Jun