| Versionen | |
|---|---|
| drupal7 | public InsertQuery_mysql::execute() |
includes/
<?php
public function execute() {
// Confirm that the user did not try to specify an identical
// field and default field.
if (array_intersect($this->insertFields, $this->defaultFields)) {
throw new PDOException('You may not specify the same field to have a value and a schema-default value.');
}
if (count($this->insertFields) + count($this->defaultFields) == 0) {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
}
$last_insert_id = 0;
$max_placeholder = 0;
$values = array();
foreach ($this->insertValues as $insert_values) {
foreach ($insert_values as $value) {
$values[':db_insert_placeholder_' . $max_placeholder++] = $value;
}
}
$last_insert_id = $this->connection->query((string) $this, $values, $this->queryOptions);
// Re-initialize the values array so that we can re-use this query.
$this->insertValues = array();
return $last_insert_id;
}
?>
Kommentare
Kommentar hinzufügen