FaaPz / PDO

Just another PDO database library
MIT License
316 stars 103 forks source link

How to +1 for some field? #108

Closed overMiracle closed 5 years ago

overMiracle commented 6 years ago

dateStatement = $this->getMysql()->update([$field => $field . '+' . $num]) ->table($tableName) ->where('id', '=', $id); $updateStatement->execute(); Above is wrong!How to do?

kwhat commented 5 years ago

This does not exist due to an oversight on my part. I will see if I can come up with a good way to do this.

kwhat commented 5 years ago

Ok, I am merging pull request #115 that contains a Clause\Raw class to accomplish these escapes.

$dateStatement = $this->getMysql()->update([$field => new Raw($field . '+' . $num)])
->table($tableName)
->where('id', '=', $id);
$updateStatement->execute();

I am not sure if this will be the final API, but it should unblock this moving forward.