Hi,
In file sql/item_cmpfunc.cc , Item_func_regex::regcomp function I can't understand the following block's task. (or what is being checked in side the if). please help

Line 5019

if (cmp_collation.collation != regex_lib_charset)
  {
    /* Convert UCS2 strings to UTF8 */
    uint dummy_errors;
    if (conv.copy(res->ptr(), res->length(), res->charset(),
                  regex_lib_charset, &dummy_errors))
      return 1;
    res= &conv;
  }

thanks


On Mon, Jul 22, 2013 at 3:11 AM, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Sudheera!

On Jul 21, Sudheera Palihakkara wrote:
> Hi all,
>
> I'm replacing the current regular expression library with modern
> library(pcre) for mariadb. I need some information about the ways that code
> uses the old regex library. The relevant codes are in sql/item_cmpfunc.cc
> directory. For exapmle in the function : int Item_func_regex::regcomp(bool
> send_error) I can't understand most of the lines, and the code is not
> well-commented. In the new library(pcre) uses different way to compile a
> regEx so I have to understand this and code for pcre preserving the
> functionalists of the class. Is there any documentation for this file or
> the way they used to work with old regex library ? thanks.

This class uses four functions of our old regex library - my_regcomp(),
my_regerror(), my_regexec(), my_regfree().

If you remove the "my_" prefix, you can google them out, regcomp,
regerror, regexec, regfree - they're all pretty standard.

I presume pcre has something similar.

Regards,
Sergei



--
Sudheera Palihakkara.
Undergraduate
Department of Computer Science and Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.