Chad,
> ChangeSet@stripped, 2007-07-31 08:56:25-04:00, cmiller@stripped +13 -0
> Bug#13174: SHA2 function
> Patch contributed from Bill Karwin, paper unnumbered CLA in Seattle
> libmysqld/Makefile.am@stripped, 2007-07-31 08:55:45-04:00, cmiller@stripped
> +2 -0
> Include standard DEFS in embedded compilation. It's an undiscovered
> but that it's not there.
I'd like to see a verbose comment here about the @DEFS@ issue, and why
it requires #if !defined(EMBEDDED_SERVER) tests for code that depends on
SSL library functionality. And s/but/bug/.
>
> Add new file to source list.
>
<cut>
> sql/item_strfunc.cc@stripped, 2007-07-31 08:55:46-04:00, cmiller@stripped
> +145 -6
> Add new SHA2 Item class methods.
>
> Clean up two minor problems.
Similarly, would be nice to have a comment here regarding the embedded
server not including SHA2(), and that it's likely a bug which should be
fixed in the build system.
<cut>
> diff -Nrup a/sql/item_strfunc.cc b/sql/item_strfunc.cc
> --- a/sql/item_strfunc.cc 2007-06-30 13:43:51 -04:00
> +++ b/sql/item_strfunc.cc 2007-07-31 08:55:46 -04:00
<cut>
> @@ -218,6 +221,142 @@ void Item_func_sha::fix_length_and_dec()
> MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
> }
>
> +String *Item_func_sha2::val_str(String *str)
> +{
> + DBUG_ASSERT(fixed == 1);
> +#if defined(HAVE_OPENSSL) && ! defined(EMBEDDED_LIBRARY)
Maybe add a small comment, like /* Build system currently doesn't link
SSL library into embedded server */ or whatever is appropriate.
> + static unsigned char digest_buf[SHA512_DIGEST_LENGTH];
I don't like this static. Shared data is not good here.
> + uint i;
> + char *p;
> + String *input_string;
> + unsigned char *input_ptr;
> + size_t input_len;
> + uint digest_length= 0;
I think you want to add str->set_collation(&my_charset_bin) here.
> + if ((null_value= args[0]->null_value))
> + {
> + return (String *) NULL;
I don't think that cast is useful?
<cut>
Regards,
Timothy
--
-- Timothy Smith Team Lead, Maintenance; Dolores, Colorado, USA
-- MySQL, www.mysql.com The best DATABASE COMPANY in the GALAXY!