public function execute($dbh) { $pk_from = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $this->from_who); $pk_to = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $this->who_to); $type_name = SDO_DAS_Relational_DataObjectHelper::getApplicationType($this->from_who); $name_of_the_pk_column = $this->object_model->getPropertyRepresentingPrimaryKeyFromType($type_name); $stmt = "UPDATE {$type_name} SET {$this->property_name} = ? WHERE {$name_of_the_pk_column} = ?"; $value_list = array($pk_to, $pk_from); SDO_DAS_Relational_DatabaseHelper::executeStatementTestForCollision($dbh, $stmt, $value_list); }
public function convertNonContainmentReferencesFromObjectToPK() { $type = SDO_DAS_Relational_DataObjectHelper::getApplicationType($this->do); foreach ($this->settings_for_where_clause as $prop => $value) { if ($value === null) { continue; } if ($this->object_model->isNonContainmentReferenceProperty($type, $prop)) { $pk = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $value); $this->settings_for_where_clause[$prop] = $pk; } } }
public function addFKToParentToSettings() { $type = SDO_DAS_Relational_DataObjectHelper::getApplicationType($this->do); $containing_reference = $this->object_model->getContainingReferenceFromChildType($type); if ($containing_reference != null) { $fk = $this->object_model->getTheFKSupportingAContainmentReference($containing_reference); $from_column_name = $fk->getFromColumnName(); $parent_do = $this->do->getContainer(); $parentPK = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $parent_do); $this->settings_for_insert[$from_column_name] = $parentPK; } }
public function convertNonContainmentReferencesFromObjectToPK() { $type = SDO_DAS_Relational_DataObjectHelper::getApplicationType($this->do); foreach ($this->settings_for_set_clause as $prop => $value) { if ($value === null) { continue; } if ($this->object_model->isNonContainmentReferenceProperty($type, $prop)) { $pk = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $value); if ($pk === null) { // this must point to an object just created with no PK set yet, so spawn a later update $who_to = $this->settings_for_set_clause[$prop]; $this->spawned_actions[] = new SDO_DAS_Relational_UpdateNonContainmentReferenceAction($this->object_model, $this->do, $prop, $who_to); unset($this->settings_for_set_clause[$prop]); } else { $this->settings_for_set_clause[$prop] = $pk; } } } foreach ($this->settings_for_where_clause as $prop => $value) { if ($value === null) { continue; } if ($this->object_model->isNonContainmentReferenceProperty($type, $prop)) { $pk = SDO_DAS_Relational_DataObjectHelper::getPrimaryKeyFromDataObject($this->object_model, $value); $this->settings_for_where_clause[$prop] = $pk; } } }