[Fwd: phpopentracker and DNS error]
| From: | Sebastian Bergmann | Date: | Wed, 24 Jan 2001 09:54:58 +0000 |
| Subject: | [Fwd: phpopentracker and DNS error] | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1142@lists.php.net to get a copy of this message | ||
Yahoo wrote:
> > > On this topic however, I would recommend a phpOpenTracker
> > > branded sequence name such as pot_data_seq and
> > > pot_accesslog_id_seq rather then the easy-to-be-in-conflict
> > > data_seq and accesslog_id_seq.
> >
> > Those tables are handled by PEAR::DB, we cannot change the names from
> > within phpOpenTracker.
> >
>
> I have been searching the docs a bit and I'm confused. This is the nextid
> function from PEAR
>
> ------- from pear/DB/pgsql.php:502 ------------------------------
> function nextId($seq_name, $ondemand = true)
> {
> $sqn = preg_replace('/[^a-z0-9_]/i', '_', $seq_name);
> $repeat = 0;
> do {
> $result = $this->query("SELECT NEXTVAL('${sqn}_seq')");
> if ($ondemand && DB::isError($result) &&
> $result->getCode() == DB_ERROR_NOSUCHTABLE) { // note
> this line
> $repeat = 1;
> $result = $this->createSequence($seq_name);
> if (DB::isError($result)) {
> return $result;
> }
> } else {
> $repeat = 0;
> }
> } while ($repeat);
> if (DB::isError($result)) {
> return $result;
> }
> $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
> $result->free();
> return $arr[0];
> }
> ------------------------------------------------------------
>
> The problem I had with installing pgsql and POT was that this error msg
> noted above was incorrect. In fact, the db was returning -1 (undefined
> error). This broke the test to create new a table, and hence, POT didn't
> get an id.
>
> I have changed the db table names by prepending 'pot_' to them for better
> grouping on our site. Your reply suggests that the error occurred because
> the first table was called something different - yet I see no mention of
> pgsql testing for a table before making a sequence table. They are free to
> be called anything you want so we made new ones to fits POT's needs.
>
> As such I was suggesting changing:
> includes/core.php:152
> so it read:
> $data_id = $this->db->nextid( POT_DATA_TABLE);
>
> and
>
> includes/live.php:59
> to:
> $this->accesslog_id = $this->db->nextid( POT_ACCESSLOG_TABLE);
>
> Can you point to some better literature about this. As it stands, it looks
> like a bug in PEAR.
--
sebastian bergmann e-mail : sb@sebastian-bergmann.de
homepage : http://www.sebastian-bergmann.de
make a gift : http://wishlist.sebastian-bergmann.de
measure the usability of your web application -> http://phpOpenTracker.de