Bug Report #4047
Returning if query was successful in UPDATE
| Status: | Closed | Start date: | 06/15/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | Kohana v3.x - v3.2.0 | |||
| Resolution: | invalid | Points: |
Description
Currently the we get the number of affected rows on UPDATE queries.
It would be good if we would also get if the query itself was successful.
Scenario:
I want to update a row with the same data as in the database.
Although the query runs ok, the affected rows will remain 0 because nothing was updated.
We need a differentiation between affected rows and query successful.
History
Updated by Vit Brunner almost 2 years ago
- Kohana_Database_MySQL::query() throws Database_Exception when mysql_query returns false
- Kohana_Database_PDO::query() rethrows PDOException from PDO::query()
In my opinion, it would be better to rethrow as Database_Exception in the second case (for consistency).
If that is done, Kohana_Database::query() should have this in PHPDoc:
@throws Database_Exception
Updated by Jeremy Bush almost 2 years ago
- Status changed from New to Closed
- Target version set to v3.2.0
- Resolution set to invalid
Yeah, I'm not sure what you mean. An "unsuccessful" query (one that never hit the database) would result in a database exception.
In your scenario, the query was successful.
Updated by Vit Brunner almost 2 years ago
As for my previous comment, I didn't realize I was looking at early 3.0 branch. Kohana_Database_PDO::query() throws Database_Exception on 3.x/master. So please disregard my previous comment :)