(DB_DataObject, pgsql, sequences) revisited
| From: | Jeff Hunt | Date: | Wed, 21 Apr 2004 22:11:33 +0000 |
| Subject: | (DB_DataObject, pgsql, sequences) revisited | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12010@lists.php.net to get a copy of this message | ||
Hello everyone,
I've searched high and low to find help with my situation. As one can
assume, I'm having problems with inserting records into a postgresql table
that contains a primary key with an attached sequence.
My problem is that while the sequence is supposed to increment the unique
identifier by 1, DB_DataObject chooses to ignore this and keeps trying to
create records with the primary key value set to 1. It just won't
increment the value as the sequence dictates, which leads me to believe
that DB_DataObject, as it is currently configured, isn't even bothering to
check the sequence.
I read the archived messages on this topic before I decided to write this
message, but I can't really make top or bottom of anything. So, here's the
info:
I set up the extended classes for my tables using the generator.
Here is the table structure, as written in the extended class by the
generator for the table in question:
var $__table = 'users'; // table name
var $user_id; // int4(4) not_null
default_nextval(public.users_user_id_seq::text) unique primary
var $user_name; // varchar(-1)
var $email; // text(-1)
var $password; // varchar(-1)
var $real_name; // varchar(-1)
I'm using DB_DataObject 1.5.3 with postgreSQL 7.4.1 and the stock
distribution of DB that came with PHP 4.3.4, in case that helps.
So, my question is: How can I tell DB_DataObject to use a particular
sequence when inserting records into a table? Or, perhaps, how can I tell
DB_DataObject to use the sequence associated with the primary key of the
table that I am inserting data into?
I apologize if this territory has been covered before, but I couldn't find
any obvious answers. Many thanks in advance for whatever advice may come
my way :)
Jeff
--
Jeff Hunt
jhunt@dropkick.org