Re: Package proposal: Unique

From: Date: Tue, 24 Jun 2003 16:16:19 +0000
Subject: Re: Package proposal: Unique
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17675@lists.php.net to get a copy of this message
Hi! cagrET wrote:
Class provides methods to generate and hold unique ID's. The aim is to avoid multiple same records in your database tables. 1. Generate unique ID 2. Include it in your html FORM as post input etc 3. Check if incoming ID is unique, If yes then add this ID to unique_id table and add record example of use here: http://scg.milc.pl/cagret/Unique/example.php class here: http://scg.milc.pl/cagret/Unique/Unique.php there is also automate garbage collection of unique ID's - u can set maxlifetime
Class:
    function &instance()
    {
        static $instance;
        return $instance;
    }
Example: $Uniq =& Unique::instance(); $Uniq will be null here, unless I'm missing something. Besides, in Unique::factory() method: $this->Db =& Db::instance(); PEAR's DB class does not have an instance() method. Moral: the stuff was *never* actually tested before being proposed here.

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