Bug #18253 Updated: ADO Function Execute() doesn't return right amount of affected rows
| From: | phanto@php.net | Date: | Wed, 17 Jul 2002 22:48:01 +0000 |
| Subject: | Bug #18253 Updated: ADO Function Execute() doesn't return right amount of affected rows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14469@lists.php.net to get a copy of this message | ||
ID: 18253
Updated by: phanto@php.net
Reported By: mkools@euronet.nl
-Status: Open
+Status: Bogus
Bug Type: COM related
Operating System: Windows 2000 Pro SP2
PHP Version: 4.2.1
New Comment:
your code is wrong, try
$Vrows = new VARIANT();
<..>
$Vrows->value will most likely -1 then as almost no ADODB provider
returns the right count.
alternatively you can try using $this->QueryResult->RecordCount
harald
Previous Comments:
------------------------------------------------------------------------
[2002-07-09 19:11:13] mkools@euronet.nl
Forgot this in the original post: The queries itself do seem to work
fine, so it's only the affectedrows which isn't working.
------------------------------------------------------------------------
[2002-07-09 19:09:42] mkools@euronet.nl
I'm currently in the process of writing a wrapper class to connect
through ADO with an MS Access database. The whole class works, except
for one thing: I can't get the amound of affected records of an insert,
update or delete statement.
What I have now is this:
$Vrows = new VARIANT( 0, VT_I4|VT_BYREF);
$this->QueryResult = @$this->Link->Execute( $inQuery, $Vrows);
$this->AffectedRows = $Vrows->value;
Explaination: QueryResult will be my RecordSet, Link is the ADO
Connection object, inQuery is the query itself and AffectedRows will
hold the amount of affected records by the query.
But this seems to return the value 7779424 in all cases (even with
select statements).
The second things I've tried is:
$this->QueryResult = @$this->Link->Execute( $inQuery,
&$this->AffectedRows);
But that doesn't do anything with the AffectedRows variable. It keeps
holding the value of what I put in it previously (I default it to -1).
Is this a bug, or am I doing things totally wrong? I found the latter
syntax on some other places on the web, so either those aren't working
either or I'm forgetting something...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18253&edit=1