[Phpmyadmin-devel] Refactoring: Displaying query results
Chanaka Dharmarathna
pe.chanaka.ck at gmail.com
Tue Jun 19 11:53:39 CEST 2012
On Tue, Jun 19, 2012 at 2:37 PM, Rouslan Placella <rouslan at placella.com>wrote:
> On 19/06/12 09:35, Chanaka Dharmarathna wrote:
> > On Mon, Jun 18, 2012 at 6:36 PM, Chanaka Dharmarathna<
> > pe.chanaka.ck at gmail.com> wrote:
> >
> >>
> >>
> >> On Sun, Jun 17, 2012 at 4:39 PM, Marc Delisle<marc at infomarc.info>
> wrote:
> >>
> >>> Le 2012-06-16 00:26, Chanaka Dharmarathna a écrit :
> >>>
> >>>> Hi All,
> >>>>
> >>>> I have already create a class for display_tbl.lib.php
> >>>> andPMA_getDataCellForBlobField() in master used the
> >>>> PMA_mimeDefaultFunction() function as a global function.
> >>>> EX :
> >>>> $str = 'PMA_mimeDefaultFunction';
> >>>> $str($parameters);
> >>>>
> >>>> I have moved the PMA_mimeDefaultFunction() from display_tbl.lib.php
> (in
> >>>> master) to common.lib.php file due to the way it has used inside
> >>>> display_tbl.lib.php.
> >>>>
> >>>> Now I'm implementing class behavior in common.lib.php file.
> >>>> So can anyone tell me a file, which contain global function, to where
> I
> >>>> should again move this PMA_mimeDefaultFunction().
> >>>>
> >>>> Regards !
> >>>
> >>> Chanaka,
> >>> I believe that this function should not be global, as it's only called
> >>> from other functions in libraries/DisplayResults.class.php, right?
> >>>
> >>> --
> >>> Marc Delisle
> >>> http://infomarc.info
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Live Security Virtual Conference
> >>> Exclusive live event will cover all the ways today's security and
> >>> threat landscape has changed and how IT managers can respond.
> Discussions
> >>> will include endpoint security, mobile security and the latest in
> malware
> >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >>> _______________________________________________
> >>> Phpmyadmin-devel mailing list
> >>> Phpmyadmin-devel at lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
> >>>
> >>
> >> Hi Marc,
> >>
> >> Sorry for little bit delay to respond.
> >> I first try to use this function while it is inside the
> PMA_DisplayResults
> >> class.
> >> But if there is any field with transformations, it does not work
> properly.
> >>
> >> So that put it as a global function.
> >> But I can again consider on that after completing the implement class
> >> behavior of common.lib.php file
> >> For just now I move PMA_mimeDefaultFunction() function to core.lib.php
> >> file.
> >>
> >>
> >> Regards !
> >> --
> >> ____________________________________
> >>
> >> Chanaka Indrajith
> >> Bsc.Computer Engineering Undergraduate
> >> Faculty of Engineering
> >> University of Peradeniya
> >> Sri Lanka
> >> ____________________________________
> >>
> >>
> > Hi Michal,
> >
> > There are many places which are using functions in common.lib.php file.
> > After implement the class behavior for this file, all the other places
> need
> > to call those functions using an object of PMA_CommonFunctions class.
> > Even in the same file I may need to create several objects of the
> > PMA_CommonFunctions class. (files with global functions)
> >
> > So I' thinking of using global variable (in $GLOBALS super global array)
> to
> > store an object of PMA_CommonFunctions class and introduce a global
> > function (may be under core.lib.php) to get that object by checking
> whether
> > the global variable is set or not.
> > So that even inside the procedural code segments, that function can be
> used.
> > Its highly appreciated if you can give me your feedback on this approach.
> >
> > Regards !
>
>
> What you seem to want is a singleton [0]. In a few words: the
> constructor is private, the instance is in a static variable and a
> public getInstance method allows access to the instance. You can also
> have a look at the PMA_Response class for a concrete example.
>
> Bye,
> Rouslan
>
> [0]: http://en.wikipedia.org/wiki/Singleton_pattern
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>
Hi Rouslan,
Thanks for your quick and valuable information.
Singleton pattern definitely use only one object and it save the memory.
I'll use that.
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/20120619/67db2317/attachment.html>
More information about the Developers
mailing list