[Phpmyadmin-devel] $cfg - Functions and RestrictFunctions

Piotr Przybylski piotr.prz at gmail.com
Mon Jul 4 11:28:49 CEST 2011

2011/7/4 Dieter Adriaenssens <dieter.adriaenssens at gmail.com>:
> 2011/7/3 Piotr Przybylski <piotr.prz at gmail.com>:
>> 2011/7/3 Dieter Adriaenssens <dieter.adriaenssens at gmail.com>:
>>> 2011/7/3 Piotr Przybylski <piotr.prz at gmail.com>:
>>>> 2011/7/2 Marc Delisle <marc at infomarc.info>:
>>>>> Le 2011-07-02 16:09, Piotr Przybylski a écrit :
>>>>>> 2011/7/2 Marc Delisle<marc at infomarc.info>:
>>>>>>> Le 2011-07-01 18:57, Piotr Przybylski a écrit :
>>>>>>>> On a related topic - do we need these to be configurable in
>>>>>>>> config.inc.php? I think these could be moved to a separate file (eg.
>>>>>>>> libraries/mysql.data.php), along with everything that is in
>>>>>>>> config.default.php under "MySQL settings" comment. I see no reason
>>>>>>>> anybody would want to change these, unless you desperately need a user
>>>>>>>> defined function available in phpMyAdmin interface.
>>>>>>> Piotr,
>>>>>>> is this a problem to leave them configurable? Some users or providers
>>>>>>> probably changed the configuration since it is configurable.
>>>>>> No, I will just have to do a bit more work to filter this for Drizzle :)
>>>>>> I was just wondering, because the only use case I can think of is to
>>>>>> add custom native functions.
>>>>> It can be also to remove unused functions in order to shorten the lists.
>>>>> By the way, my assumption about the need of some for leaving it
>>>>> configurable is just an assumption.
>>>>> I suggest asking about this on the phpmyadmin-users list.
>>>> Adding Drizzle functions look messy [1] and I am not satisfied with
>>>> how this turned out. Here's an idea I would like to try, which would
>>>> make it cleaner while still leaving these arrays configurable the same
>>>> way as they are now:
>>>> 1. I extract them to a separate file, eg. server_data_mysql.inc.php
>>>> 2. arrays in config.default.php will become empty (just "array()").
>>>> 3. If a non-empty value would appear in config.inc.php, it would
>>>> overwrite data from new server_data_mysql.inc.php
>>>> 4. My Drizzle-specific code would go mostly to server_data_drizzle.inc.php
>>>> Pros:
>>>> - after code refactoring and committing 1-3 to master I have to change
>>>> just one file and make only small adjustments to add Drizzle support,
>>>> - on average, less code to parse for phpMyAdmin and less data to store
>>>> in memory because these are used only on three occasions - in db
>>>> routines, table creation and column editing.
>>> So, if I get this right, you will create two sets of arrays, one set
>>> for MySQL and one set for Drizzle, which both go into a seperate
>>> include file. Where the file that gets included depends on the
>>> database server type.
>> Yes. And users will still be able to overwrite this in config.inc.php.
>> An added perk will be that at the point this file is processed we have
>> access to database server version, so we will be able to add
>> TO_SECONDS and UUID_SHORT for newer MySQL versions.
> But this also means that two lists of functions/... need to be
> maintained?

Two similar lists instead of one big for MySQL and two lists of
differences to Drizzle (for new and removed functions), which is IMO
better - we get two readable arrays and can always do a nice visual
diff to look for differences between them.

> Or is there a way of getting a list of functions that is
> available on the database-server (like what you did to get the
> functions of the Drizzle plugins)?

Most functions are there, but some are missing. I am  guessing that
standard ANSI SQL functions are just built-in. Second problem -
'Functions' array should contain only functions taking none or one
argument which is string or can be transparently converted to correct
type by MySQL server, and there is no way to get that information that
I know of.

Piotr Przybylski

More information about the Developers mailing list