php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #28526 Add 'dbx_num_affected_rows' function
Submitted: 2004-05-26 13:43 UTC Modified: 2017-08-23 00:24 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: johnw at sussex dot ac dot uk Assigned: kalle (profile)
Status: Closed Package: DBX related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2004-05-26 13:43 UTC] 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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-08 14:35 UTC] 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-06-10 00:54 UTC] 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-10 09:47 UTC] mboeren@php.net
Luckily, there is also a $result->handle that you can use :-)
 [2016-12-30 19:00 UTC] cmb@php.net
-Package: Feature/Change Request +Package: DBX related
 [2017-08-23 00:24 UTC] kalle@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2017-08-23 00:24 UTC] kalle@php.net
Gonna close this as the DBX package has no activity, if an active maintainer takes it over then please re-open
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC