#28526 [Opn]: Add 'dbx_num_affected_rows' function
ID: 28526
Updated by: mboeren@php.net
Reported By: johnw at sussex dot ac dot uk
Status: Open
Bug Type: Feature/Change Request
PHP Version: Irrelevant
New Comment:
Luckily, there is also a $result->handle that you can use :-)
Previous Comments:
------------------------------------------------------------------------
[2004-06-10 00:54:09] johnw at sussex dot ac dot uk
Thanks for the suggestion but unfortunately I am using
Oracle (OCI8) where the 'native' function for getting
the number of affected rows needs to be applied to the
statement handle returned by OCIParse, not the
connection handle returned by OCILogon.
------------------------------------------------------------------------
[2004-06-08 14:35:14] mboeren@php.net
While waiting for someone to actually implement this, the following
snippet (untested) might be useful:
$link = dbx_connect(DBX_MYSQL, "localhost", "db", "username",
"password");
$result = dbx_query($link, "DELETE FROM table WHERE name=''");
echo mysql_affected_rows($link->handle);
------------------------------------------------------------------------
[2004-05-26 13:43:56] johnw at sussex dot ac dot uk
Description:
------------
It would be very useful (to me at least) if the dbx
module included a function for returning the number of
rows affected by an INSERT, UPDATE, or DELETE statement.
Implementation suggestion: the function DBX_QUERY could
call the relevant database-specific function after an
update/insert/delete and save the result in the link
identifier object. A new function DBX_NUM_AFFECTED_ROWS
would retrieve this saved value from the link
identifier.
Possibly a select query would cause the
'num_affected_rows' value to be set to 0, for neatness.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28526&edit=1
Thread (5 messages)