Jan-Henrik,
Is the a way to obtain the number of affected rows after executing a prepared statement, like there is for Connection_execute?
On Aug 2, 2013, at 12:50 PM, Paul J Stevens paul@nfg.nl wrote:
Is the a way to obtain the number of affected rows after executing a prepared statement, like there is for Connection_execute?
The following actually works for SQLite
... PreparedStatement_execute(pre); printf("Affected rows: %lld\n", Connection_rowsChanged(con));
But not for Postgres nor MySQL (or Oracle I guess). A PreparedStatement object uses a separate statement from its parent connection. That it works for SQLite is probably due to some coincidental implementation details not to be relied upon.
However, adding and implementing PreparedStatement_rowsChanged in libzdb is trivial for MySQL, SQLite and Postgres and I assume also for Oracle (Volodymyr can probably answer that). Since you ask I guess this is something you need?
If we are going to change the PreparedStatement.h API are there other functionality you have missed in this interface?
On 02-08-13 19:57, Jan-Henrik Haukeland wrote:
However, adding and implementing PreparedStatement_rowsChanged in libzdb is trivial for MySQL, SQLite and Postgres and I assume also for Oracle (Volodymyr can probably answer that). Since you ask I guess this is something you need?
Well, 'need' is too much, 'nice-to-have' would cover it more. So don't sweat over it. Turns out I can work around it for now.
I just wondered if there was a specific reason not to add it.
thanks.
On Aug 3, 2013, at 11:24 AM, Paul J Stevens paul@nfg.nl wrote:
On 02-08-13 19:57, Jan-Henrik Haukeland wrote:
However, adding and implementing PreparedStatement_rowsChanged in libzdb is trivial for MySQL, SQLite and Postgres and I assume also for Oracle (Volodymyr can probably answer that). Since you ask I guess this is something you need?
Well, 'need' is too much, 'nice-to-have' would cover it more. So don't sweat over it. Turns out I can work around it for now.
Added, but need help from Volodymyr to test on Oracle. Otherwise it works for SQLite, MySQL and Postgres.