Results 1 to 4 of 4

Thread: mysql mystery call

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Beans
    33

    mysql mystery call

    Hi guys, the following code makes a call to a
    Code:
    preg_replace
    function that I cant seem to find on the db.

    Code:
    CREATE DEFINER=`root`@`localhost` FUNCTION `makehash`(description text, raw_location text, title text) RETURNS varchar(32) CHARSET utf8
        NO SQL
        DETERMINISTIC
    begin
        declare data longtext;
        declare hash varchar(32);
        set data = ifnull(description, '');
        set hash = null;
        if length(data) > 64 then
            set data = lower(concat(data, ifnull(raw_location, ''), ifnull(title, '')));
            set hash = md5(preg_replace('/[^a-z]/', '', data));
        end if;
    return hash;
    end
    Basically, I have two dbs and am moving from one to the other. I almost there apart from this last thing prevents things from running.

    I have run
    Code:
    show procedure status
    and
    Code:
    show function status
    but can't see this anywhere.

    Are there another mysql constructs like functions and procedures that can be called like this that I may have missed?

  2. #2
    Join Date
    Nov 2009
    Beans
    1,081

    Re: mysql mystery call

    Regular expression handling. Not a MySQL guru, but that line will set 'hash' to be the MD5 checksum of a modified version of 'data' where everything -except- lower-case letters (*) has been removed.


    (*) specifically, a-z; I suspect that something like é would be removed because it is not within that set. Encoding issues, oh joy!

  3. #3
    Join Date
    Jan 2009
    Beans
    33

    Re: mysql mystery call

    Thanks for the reply. I am aware of what the function is trying to but I cant find it in the table I copied the other function from even though everything runs fine on it.

  4. #4
    Join Date
    Nov 2009
    Beans
    1,081

    Re: mysql mystery call


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •