BUGFIX Proper use of sqlsrv_rows_affected()

This commit is contained in:
Sean Harvey 2010-03-08 20:15:27 +00:00
parent 036570e3c1
commit 661ce65d24

View File

@ -42,12 +42,6 @@ class MSSQLDatabase extends SS_Database {
*/
protected $mssql = null;
/**
* Sorts the last query's affected row count, for sqlsrv module only.
* @todo This is a bit clumsy; affectedRows() should be moved to {@link Query} object, so that this isn't necessary.
*/
protected $lastAffectedRows;
/**
* Words that will trigger an error if passed to a SQL Server fulltext search
*/
@ -224,13 +218,7 @@ class MSSQLDatabase extends SS_Database {
Debug::message("\n$sql\n{$endtime}ms\n", false);
}
DB::$lastQuery=$handle;
if(!$handle && $errorLevel) $this->databaseError("Couldn't run query: $sql", $errorLevel);
if (!$this->mssql) {
$this->lastAffectedRows = sqlsrv_rows_affected($handle);
}
return new MSSQLQuery($this, $handle, $this->mssql);
}
@ -822,7 +810,7 @@ class MSSQLDatabase extends SS_Database {
if($this->mssql) {
return mssql_rows_affected($this->dbConn);
} else {
return $this->lastAffectedRows;
return sqlsrv_rows_affected($this->dbConn);
}
}
@ -1517,7 +1505,7 @@ class MSSQLQuery extends SS_Query {
if($this->mssql) {
mssql_free_result($this->handle);
} else {
if($this->handle) sqlsrv_free_stmt($this->handle);
sqlsrv_free_stmt($this->handle);
}
}