[Phpmyadmin-devel] about $common_functions

Chanaka Dharmarathna pe.chanaka.ck at gmail.com
Tue Jul 3 16:46:12 CEST 2012


Hi Marc,

Ok, so what do you think of this code snippet:
>
> $query[] = $insert_command . 'INTO '
>  . PMA_CommonFunctions::getInstance()->backquote($GLOBALS['db']) . '.'
>  . PMA_CommonFunctions::getInstance()->backquote($GLOBALS['table'])
>         . ' (' . implode(', ', $query_fields) . ') VALUES ('
>         . implode('), (', $value_sets) . ')';
>
> Does this follow the singleton principle?
>

As I think this doesn't break the singleton principle since we are not
creating two objects.
Since the private constructor always give the existing PMA_CommonFunctions
object if there exist any, no more objects are created.

Actually why I used that $common_functions variable is, reducing the line
length and if there are frequent occurrence inside procedural code or
function, its easy to use a variable than this lengthy code.
As well we have discussed to reduce the use of globals.

Please make me correct if I did any wrong.

Regards !
-- 
____________________________________

Chanaka Indrajith
Bsc.Computer Engineering Undergraduate
Faculty of Engineering
University of Peradeniya
Sri Lanka
____________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120703/339e8abf/attachment.html>


More information about the Developers mailing list