List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:August 15 2006 7:39am
Subject:Re: UDF XML functions
View as plain text  
Hi!

On Aug 15, mysql@stripped wrote:
> Hi all,
>  
> I'm having a crack at writing some user defined functions to output XML
> directly from a mysql query. The best way I've come up with is using
> subqueries with GROUP BY's. The functions will use libxml's xmlwriter to
> generate an xml string. I know this method should work, because it can
> also be done using CONCAT and GROUP_CONCAT functions. (Please have a
> look at the code below)
>  
> I've looked on the internet, but the best thing I found is MyXML, which
> is simply too limited (and looks not supported). Is anyone currently
> already working on this or is MySQL AB itself working on XML output
> functions.

No, not that I know of.
  
> I've also got a direct question. What is exactly the function of
> group_concat_max_len? I got the impression that memory the size of
> group_concat_max_len is allocated for each group_concat call.

No, the memory is allocated dynamically, but group_concat_max_len limits
the total amount that can be allocated for one group - that is, it
limits the length of a string that GROUP_CONCAT can generate.

> If so, I hope to prevent doing the same using xmlwriter. I'm not sure,
> but at the first glance it looks like xmlwriter allocates memory
> dynamically. 

group_concat_max_len is a simple protection against mistakes like
concatenating all blobs in a table (e.g. one hits enter before finishing
GROUP BY clause in a query).

Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Kerpen, Germany
       <___/  www.mysql.com
Thread
UDF XML functionsmysql15 Aug
  • Re: UDF XML functionsSergei Golubchik15 Aug
  • Re: UDF XML functionsBrian Aker15 Aug
    • Re: UDF XML functionsArnold Daniels6 Sep