Re: DBO - Insert issue

From: Date: Sun, 11 Jan 2004 12:16:15 +0000
Subject: Re: DBO - Insert issue
References: 1  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-10103@lists.php.net to get a copy of this message
Looks like it thinks IncidentID is the 'default sequence Key' try adding this method to the IncidentType class. function sequenceKey() { // return - no sequences, not native... return array(false,false); } or add the ini option ignore_sequence_keys = IncidentType (needs CVS version or version1.3 though) The whole sequencing needs more examination.. - partly in context of discussions that are going on in pear-dev about improving the introspection information returned by pear:db. Regards Alan Barry Steele wrote:
Hi, I am having a troubling time with an insert using DB_DataObject <code> $incType->TypeID = $this->decodeID($k); $incType->Expl = $inputData['Type'][$k.'Expl']; $incType->ChangeDate= date("Y-m-d"); $incType->CreationDate= date("Y-m-d"); $incType->IncidentID = $incidentID; echo "Trying to insert a new IncidentType Record for incident ".$incType->IncidentID."<br>"; Var_Dump::display($incType); $incType->debugLevel(1); $newIncTypeID = $incType->insert(); </code> and I get <output> bject vars Array(16)
                              + _DB_DataObject_version String[3]  (1.4)
              | __table                String[12] (IncidentType)
              | N                      Long       (0)
              | _database_dsn          String[0]  ()
              | _database_dsn_md5      String[0]  ()
              | _database              String[0]  ()
              | _query                 Array(6)                |                                        |                        + condition   String[0] ()
              |                        | group_by    String[0] ()
              |                        | order_by    String[0] ()
              |                        | having      String[0] ()
              |                        | limit       String[0] ()
              |                        + data_select String[1] (*)
              |                                        | _DB_resultid           Null       (Null)
              | _link_loaded           Boolean    (FALSE)
              | _join                  String[0]  ()
              | _lastError             Boolean    (FALSE)
              | IncidentID             Long       (100)
              | TypeID                 String[1]  (1)
              | Expl                   Null       (Null)
              | ChangeDate             String[10] (2004-01-11)
              + CreationDate           String[10] (2004-01-11)
                DB_DataObject: QUERY: INSERT INTO IncidentType (TypeID , ChangeDate ,
CreationDate ) VALUES ( 1 , '2004-01-11' , '2004-01-11' ) DB_DataObject: SENT: INSERT INTO IncidentType (TypeID , ChangeDate ,
CreationDate ) VALUES ( 1 , '2004-01-11' , '2004-01-11' ) DB_DataObject: ERROR: DB Error: already exists
</output> So IncidentID is defined as a field in the relevant DBO definition file, but I do not see why it is not included in the Insert statement. any thoughts?, Barry
        Barry Steele
        hpfm solutions pty ltd
        mob: 0413947980
        fax:  0299817727
        mailto:: barry@hpfm.biz


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