mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX Proper use of sqlsrv_rows_affected()
This commit is contained in:
parent
036570e3c1
commit
661ce65d24
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user