#114 connection->Affected_Rows( ) return wrong answer.

open
nobody
None
5
2010-07-19
2010-07-19
OfficeCat
No

hi all,

when I execute update statement, I found that the connection->Affected_Rows() can not return correct answer.

I traced into the _query method, and found that the method will return true, if the sql statement is not start with SELECT.

so, when execute update statement, the _query method will return true, not the resource for the query.

but the Affected_Rows() will use the resource the get the count of the afftected rows.

so Affected_Rows() return the wrong answer.

now, I delete the following code Temporarily in the _query method.

//fix for returning true on anything besides select statements
if (is_array($sql)) $sql = $sql[1];
$sql = ltrim($sql);
if(stripos($sql, 'SELECT') !== 0 && $rez !== false)
{
if ($this->debug) error_log(" isn't a select query, returning boolean true");
return true;
}
//end fix

we expect new release version will fix this bug.

Discussion

  • OfficeCat
    OfficeCat
    2010-07-19

    by the way, I use mssqlnative.