|
@@ 145-150 (lines=6) @@
|
| 142 |
|
{ |
| 143 |
|
$return = false; |
| 144 |
|
$qb = $this->conn->createQueryBuilder()->insert($this->quoted_table_name); |
| 145 |
|
foreach ($data as $column => $value) { |
| 146 |
|
if ($this->getColumn($column) === null) { |
| 147 |
|
throw Schema\SchemaException::columnDoesNotExist($column, $this->table_name); |
| 148 |
|
} |
| 149 |
|
$qb->setValue($this->conn->quoteIdentifier($column), $qb->createNamedParameter($value)); |
| 150 |
|
} |
| 151 |
|
$return = (bool) $qb->execute(); |
| 152 |
|
if ($this->hasAutoIncrement()) { |
| 153 |
|
$return = $this->conn->lastInsertId(); |
|
@@ 244-249 (lines=6) @@
|
| 241 |
|
public function update(array $data, array $filters = []) |
| 242 |
|
{ |
| 243 |
|
$qb = $this->conn->createQueryBuilder()->update($this->quoted_table_name); |
| 244 |
|
foreach ($data as $column => $value) { |
| 245 |
|
if ($this->getColumn($column) === null) { |
| 246 |
|
throw Schema\SchemaException::columnDoesNotExist($column, $this->table_name); |
| 247 |
|
} |
| 248 |
|
$qb->set($this->conn->quoteIdentifier($column), $qb->createNamedParameter($value)); |
| 249 |
|
} |
| 250 |
|
$this->buildWhere($qb, $filters); |
| 251 |
|
return $qb->execute(); |
| 252 |
|
} |