mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
MINOR Better debugging in MSSQLDatabase::query()
This commit is contained in:
parent
572d025029
commit
28434a195d
@ -213,20 +213,21 @@ class MSSQLDatabase extends SS_Database {
|
||||
if(isset($_REQUEST['showqueries'])) {
|
||||
$starttime = microtime(true);
|
||||
}
|
||||
|
||||
|
||||
if($this->mssql) {
|
||||
$handle = mssql_query($sql, $this->dbConn);
|
||||
} else {
|
||||
$handle = sqlsrv_query($this->dbConn, $sql);
|
||||
if($handle) $this->lastAffectedRows = sqlsrv_rows_affected($handle);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_REQUEST['showqueries'])) {
|
||||
$endtime = round(microtime(true) - $starttime,4);
|
||||
Debug::message("\n$sql\n{$endtime}ms\n", false);
|
||||
}
|
||||
|
||||
if(!$handle && $errorLevel) $this->databaseError("Couldn't run query: $sql", $errorLevel);
|
||||
|
||||
$error = mssql_get_last_message();
|
||||
if(!$handle && $errorLevel) $this->databaseError("Couldn't run query ($error): $sql", $errorLevel);
|
||||
return new MSSQLQuery($this, $handle, $this->mssql);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user