Salutations, phpmyadmin-devel!
I today finished the JavaScript popup SQL query window (nice term ;-) which works quite nicely. Think you will pretty much like it. :)
I now started on the mimetype-stuff and have a question for you who have php3-access:
Is variable function calling possible in this version? Something like $queryfunction($string)?
It's because I'm implementing something like a transformation-plugin directory. Every php file is a transformation on its own with a specific filename. Inside the file the function should be called like the filename, so I would like to do the following:
1. Find out the mimetype and transformation for a field 2. Search for the php-file which contains the transformation 3. Include that file 4. Because multiple plugins can be called on a single page, a single function name is not possible. So I now want to call the included function with $transformation($buffer, $options).
I somehow guess, that this is not possible with PHP3? If you, can you as well check if this leads to a parse error:
if (str_replace('.', '', PHP_VERSION) > 403) { $php4functiononly(); }
If it does I would have to include this function call from another page, which will surely be a major performance hit for larger result sets. :-\
-- Bye, ...[ icq #21392242 | Garvin ...[ www.supergarv.de |
... *"Don't try and threaten me, Mulder... I watched presidents die" - CM*
-----Original Message----- From: Garvin Hicking
I today finished the JavaScript popup SQL query window (nice term ;-)
Hmm... How about SQL query JavaScript popup window? ;-)
which works quite nicely. Think you will pretty much like it. :)
Great. Could you submit a patch to the patch tracker so we can test it?
I now started on the mimetype-stuff and have a question for you who have php3-access:
Is variable function calling possible in this version? Something like $queryfunction($string)?
Afaik this is possible in PHP3, but I'm not sure. But I think we have already used this in our code.
It's because I'm implementing something like a transformation-plugin directory. Every php file is a transformation on its own with a specific filename. Inside the file the function should be called like the filename, so I would like to do the following:
- Find out the mimetype and transformation for a field
- Search for the php-file which contains the transformation
- Include that file
- Because multiple plugins can be called on a single page, a single
function name is not possible. So I now want to call the included function with $transformation($buffer, $options).
I somehow guess, that this is not possible with PHP3? If you, can you as well check if this leads to a parse error:
if (str_replace('.', '', PHP_VERSION) > 403) { $php4functiononly(); }
My ISP uses both on the webservers: .php3 files are parsed with PHP3 whereas .php files are parsed with PHP4. At about 14:00 (CET), I'll test this.
If it does I would have to include this function call from another page, which will surely be a major performance hit for larger result sets. :-\
Or you'd have to build a wrapper function that passes the parameters to the correct function. Something like:
function my_wrapper($param) { global $whatfunctiontouse; switch ($whatfunctiontouse) { case 'foo': return foo($param); case 'bar': return bar($param); case 'foobar': return foobar($param); } }
Alexander M. Turek alex@bugfixes.info
+-----------------------------+ | The phpMyAdmin Project | | http://www.phpmyadmin.net | | rabus@users.sourceforge.net | +-----------------------------+ | [bugfixes.info] | | http://www.bugfixes.info | | rabus@bugfixes.info | +-----------------------------+
Hi Rabus!
which works quite nicely. Think you will pretty much like it. :)
Great. Could you submit a patch to the patch tracker so we can test it?
I will do so as soon as I got the mime-stuff working. At the moment I have a huge working directory with 10 different fixes/new features. I will split them up to different chunks from the big file. I'm afraid I don't get the usage of splitdiff and how I can consequently update diffs without interfering themselves. So I will split it up manually as soon as my work is done. Expect all patches by Monday or Tuesday. Maybe earlier, it depends on how good everything is going.
BTW, how can I include non-added files to my diff? I created severl of them, and they don't show up using cvs diff -udHwbRN. BTW, patch file size is currently 100kb and growing...
Regards, Garvin.
On Wed, Feb 05, 2003 at 04:10:00AM +0100, Garvin Hicking wrote:
I today finished the JavaScript popup SQL query window (nice term ;-) which works quite nicely. Think you will pretty much like it. :)
Great, post up the patch for us to play with please!
Is variable function calling possible in this version? Something like $queryfunction($string)?
I'm fairly certain that $func() works, based on the fact we use it in libraries/common.lib.php3. Look for '$connect_func'.
It's because I'm implementing something like a transformation-plugin directory. Every php file is a transformation on its own with a specific filename. Inside the file the function should be called like the filename, so I would like to do the following:
- Find out the mimetype and transformation for a field
- Search for the php-file which contains the transformation
- Include that file
- Because multiple plugins can be called on a single page, a single
function name is not possible. So I now want to call the included function with $transformation($buffer, $options).
Some hints/suggestions...
Lets think about this, firstly, based on the mime-type definition...
Valid mimetype strings are in the form of: (RFCs 2045, 2046, 2047, 2048, and 2077) content := "Content-Type" ":" type "/" subtype *(";" parameter) ; case-insensitive matching of type and subtype type := "application" / "audio" / "image" / "message" / "multipart" / "text" / "video" / extension-token ; All values case-insensitive extension-token := x-token / iana-token iana-token := <a publicly-defined extension token, registered with IANA, as specified in Appendix E> x-token := <The two characters "X-" or "x-" followed, with no intervening white space, by any token> subtype := token ; case-insensitive parameter := attribute "=" value attribute := token ; case-insensitive value := token / quoted-string token := 1*<any (ASCII) CHAR except SPACE, CTLs, or tspecials> tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "" / <"> / "/" / "[" / "]" / "?" / "=" ; Must be in quoted-string, ; to use within parameter values
We should EXPECT that some users will (ab)use the defintion of mime-types to the fullest extent possible and so we should be ready to handle all options, like: application/octet-stream text/plain; charset=us-ascii application/beep+xml text/plain; charset="us-ascii" application/vnd.pwg-xhtml-print+xml model/mesh; dimension="4"; state="static"
In the above, note the exclusion of '_'. AFAIK, there exists NO mimetype with that in it. I propose that you have a PMA_transform function as follows (using the last example): Firstly: $mimearray = array( '_type' => 'model', '_subtype' => 'mesh', 'dimension' => '4', 'state' => 'static'); Note that the type/subtype have got seperate items, and then each MIME parameter is included in an exact name-value mapping. $outputdata = PMA_transform($mimearray, $parameters, $input); $parameter is the additional parameters from the column comments table.
Now in your code that actually handles the transformation: function PMA_transform($mimearray, $parameters, $input) { ... include($dir.'/'.$mimearray['_type'].'.inc.php3'); include($dir.'/'.$mimearray['_type'].'_'.$mimearray['_subype'].'.inc.php3'); ... }
Each of those files defines a single function as you suggested in the name form of: PMA_transform_$mimearray['_type']_$mimearray['_subtype']($mimeparameters,$funcparameters,$inputdata); To get around the problem of '+' existing in type names, replace any non-acceptable characters with '_'. There will be _very_ little namespace collision caused by that replacement.
Each of the files should have our if(!defined(...)) { /* contents */ } type blocks for speed reasons and avoiding errors.