DBO - Insert issue
| From: | Barry Steele | Date: | Sun, 11 Jan 2004 08:40:13 +0000 |
| Subject: | DBO - Insert issue | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10099@lists.php.net to get a copy of this message | ||
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