Commit 3460a986 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed affected_rows function in SQL plugin.

parent 64b6998e
...@@ -169,7 +169,7 @@ class pQuerySql extends pQuery { ...@@ -169,7 +169,7 @@ class pQuerySql extends pQuery {
function affected_rows() { function affected_rows() {
$this->assert_execution(); $this->assert_execution();
return is_resource($this->result) ? mysql_affected_rows($this->result) : 0; return mysql_affected_rows(self::$link);
} }
/** /**
......
...@@ -181,6 +181,7 @@ class pQuerySqlTest extends PHPUnit_Framework_TestCase { ...@@ -181,6 +181,7 @@ class pQuerySqlTest extends PHPUnit_Framework_TestCase {
function test_insert() { function test_insert() {
$insert = __sql::insert_row('foo', array('bar' => 'test3'))->execute(); $insert = __sql::insert_row('foo', array('bar' => 'test3'))->execute();
$this->assertTrue($insert->result); $this->assertTrue($insert->result);
$this->assertEquals(1, $insert->affected_rows());
} }
/** /**
...@@ -190,7 +191,7 @@ class pQuerySqlTest extends PHPUnit_Framework_TestCase { ...@@ -190,7 +191,7 @@ class pQuerySqlTest extends PHPUnit_Framework_TestCase {
function test_delete() { function test_delete() {
$delete = __sql::delete('foo', array('bar' => 'test3'))->execute(); $delete = __sql::delete('foo', array('bar' => 'test3'))->execute();
$this->assertTrue($delete->result); $this->assertTrue($delete->result);
$this->assertEquals($delete->affected_rows()); $this->assertEquals(1, $delete->affected_rows());
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment