Re: Package proposal: Unique

From: Date: Wed, 25 Jun 2003 20:20:40 +0000
Subject: Re: Package proposal: Unique
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17728@lists.php.net to get a copy of this message
Hi! cagrET wrote:
2) it won't contain any object, 'cause the reference to 'static $instance'
is
*never* accessed/assigned to in factory().
are you sure ? :) [php]
    function &factory($options)
    {
        $this->Db =& Db::instance();
        ....
    }
[/php]
Yes, I'm sure. You *never* call Unique::instance() and thus cannot set the static variable within it. Here is another fun part from factory(): [php]
       $this->Db = new Unique;
[/php] This will probably *overwrite* DB's instance. Not sure as I didn't run this, but still...
yeah im newbie, maybe could u tell me how to use them ? do u have any links to description of factory / instance patterns ?
http://www.phppatterns.com/index.php/article/articleview/6/1/1/ http://www.phppatterns.com/index.php/article/articleview/49/1/1/ These are about Singleton and Factory patterns, respectively. I don't know anything about 'instance' pattern, but usually use that method name when implementing a Registry: a mix of Factory with Singleton.
this is not PEAR's DB class http://scg.milc.com.pl/cagret/mgcLib/Db/
Wow! Yet Another Database "Abstraction" Layer For PHP! :]
look at the benchmarks, thats why i wrote it : )
The benchmarks clearly show that you'd be better using native MySQL functions. :]
it has dedbugging queries / error handling features that fit my needs, what is wrong with that ?
Nothing is wrong with that. :]
okay so could u explain me, how this should be done ? thx for help
Dunno. Last time I implemented this, I just stored the tokens in session. Thus no need to access database, no need to do separate GC...

« previous php.pear.dev (#17728) next »