DataObjects , postgresql and sequences

From: Date: Thu, 03 Apr 2003 14:09:35 +0000
Subject: DataObjects , postgresql and sequences
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4624@lists.php.net to get a copy of this message
I all, I'me currently working on a project where i'd like to use Dataobjects. I'me in troubles to find a proper way working with sequences. here is my problem under postgresql i got a table : let's say mytable this table have an associate sequence named : mytable_seq In Dataobject ini file , i didn't set any options about sequences What is the proper way for inserting datas in my table using the sequence ? i tryed : require_once('DataObjects/mytable.php'); $station = new DO_mytable; $station->sta_nom = 'courchevel'; $id = $station->insert(); but postgres returns an error code: INSERT INTO mytable (sta_nom ) VALUES ('courchevel' ) [nativecode=ERROR: ExecInsert: Fail to add null value in not null attribute sta_id ] I understand this error, but what is the proper code to avoid that ? what is the way to insert the id just extracted from the sequence ? Thanks Xavier

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