php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1944 I can't get right result number when using IFX_AFFECTED_ROWS()
Submitted: 1999-08-02 04:31 UTC Modified: 1999-08-02 05:33 UTC
From: musica98 at chollian dot net Assigned:
Status: Closed Package: Other
PHP Version: 3.0.11 OS: RedHat6.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: musica98 at chollian dot net
New email:
PHP Version: OS:

 

 [1999-08-02 04:31 UTC] musica98 at chollian dot net
* I can't get right result number when using IFX_AFFECTED_ROWS() ! *

Following is my configure and source code
-----------------------------------------
DB name    : test
TABLE name : test
DB user    : informix (pass:*****)

Schema file
---
{ TABLE "informix".test row size = 119 number of columns = 4 index size = 12 }
create table "informix".test 
  (
    id serial not null ,
    name nchar(8) not null ,
    email nvarchar(50,50),
    comment text,
    primary key (id)  constraint "informix".priid
  ) extent size 16 next size 16 lock mode row;
revoke all on "informix".test from "public";
---

PHP Source Code
---
<?
$conn_id = ifx_connect("test@linux","informix","****");
ifx_textasvarchar(1);
$query = "select * from test";
$res_id = ifx_query($query,$conn_id);
$rowcount = ifx_affected_rows($res_id);
echo($rowcount);
?>
---
--------------------------------------------

I'm insert 5 rows into test table.
But $rowcount's value is 10

I'm insert 13 rows into test table.
But $rowcount's value is 10

Alaways $rowcount's value is 10

I can't find my mistake.
How can I solve problems.


Thanks.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-02 05:33 UTC] danny at cvs dot php dot net
As stated in the manual, ifx_affected_rows() can only give
an ESTIMATE for SELECT type queries.
The number returned by ifx_affected_rows()is only exact for
INSERT/UPDATE type queries. 
This is a limitation of the Informix database. There are no
work-arounds. 
You can read up on this in the Informix ESQL/C Programmer's 
Manual, SQLCA structure, fields sqlerrd[0] and sqlerrd[2].

If you really need this number, you can excute a "select
count(*)", but don't complain about performance problems
if you do.

Danny.
---
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC