[PEAR::DB] nextID question

From: Date: Mon, 26 Jan 2004 11:31:35 +0000
Subject: [PEAR::DB] nextID question
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10354@lists.php.net to get a copy of this message
hello list, I have a problem with DB nextId function.I have search for this mailing list, and web tutorials, but cannot found a solution to my problems, hopping you could have it :) I have set a class to abstract from database with DB even if for the moment I'm under Mysql 4. here's part of my code
     // connect to database
     $sDSN = $db['type'].'://'.$db['login'].':'.$db['mdp'].'@'.$db['server'].'/'.$db['db'];
       $this->_connect($sDSN);
      // are we connected?
       if ($this->bConnect)
       {
          // get list of tables
           $this->aTablesName = $this->oDB->getListOf('tables');
           if (!is_array( $this->aTablesName))  $this->aTablesName = array();
                     // create Sequence for the insert query
           foreach( $this->aTablesName as $i => $table_name)
           {
               $this->oDB->createSequence($table_name);
               if (DB::iserror($this->oDB)) $this->_ERR_add($this->oDB->getMessage());
               else $this->aID[$table_name] = $this->oDB->nextId($table_name,true);
           }
       }
My tables haven't AUTO-INCREMENT attribute for a code DB independant. this part of code work fine, sequence are create, in local (Mysql 4.0.13) and online (Mysql 4.0.17) (I have all rights on the database). I get next Id with the following function: function getID($table_name) {
       return $this->aID[$table_name];
} but online, this function returns an Id existing in table ;( I don't understand why) whereas in localhost, I haven't any problems. My fields are smallint fields. have you a begin of solution? furthermore, if two users connect to database, sequences will be create for each users, but I suppose that all users won't have the same nextId value because one table is create for each users. How does it work? thanks in advance for your help and sorry for my poor english best regards Matthieu _____________________________________________________________________ Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

« previous php.pear.general (#10354) next »