Attached Files |
ShowServerHostName-in-Debugger.patch [^] (1,821 bytes) 2012-07-09 12:51
[Show Content]
Index: kernel/db/db_connection.php
===================================================================
--- kernel/db/db_connection.php (revision 15426)
+++ kernel/db/db_connection.php (working copy)
@@ -1100,7 +1100,7 @@
$first_cell = substr($first_cell, 0, 50) . ' ...';
}
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex . ' (' . $this->connectionParams['host'] . ')');
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
@@ -1113,7 +1113,7 @@
else {
// set 2nd checkpoint: begin
if ( $this->_profileSQLs ) {
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex . ' (' . $this->connectionParams['host'] . ')');
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
Index: kernel/utility/debugger.php
===================================================================
--- kernel/utility/debugger.php (revision 15426)
+++ kernel/utility/debugger.php (working copy)
@@ -1244,7 +1244,7 @@
$this->ProfilerData[$key]['subtitle'] = 'cachable';
}
- if ( $func_arguments[7] ) {
+ if ( (string)$func_arguments[7] !== '' ) {
$additional[] = Array ('name' => 'Server #', 'value' => $func_arguments[7]);
}
db_server_info_in_debugger_report.patch [^] (4,745 bytes) 2012-07-12 10:48
[Show Content]
Index: core/kernel/db/db_connection.php
===================================================================
--- core/kernel/db/db_connection.php (revision 15359)
+++ core/kernel/db/db_connection.php (working copy)
@@ -1025,6 +1025,14 @@
protected $_profileSQLs = false;
/**
+ * Info about this database connection to show in debugger report
+ *
+ * @var string
+ * @access protected
+ */
+ protected $serverInfoLine = '';
+
+ /**
* Initializes connection class with
* db type to used in future
*
@@ -1041,6 +1049,29 @@
}
/**
+ * Try to connect to database server
+ * using specified parameters and set
+ * database to $db if connection made
+ *
+ * @param string $host
+ * @param string $user
+ * @param string $pass
+ * @param string $db
+ * @param bool $force_new
+ * @param bool $retry
+ * @return bool
+ * @access public
+ */
+ public function Connect($host, $user, $pass, $db, $force_new = false, $retry = false)
+ {
+ if ( defined('DBG_SQL_SERVERINFO') && DBG_SQL_SERVERINFO ) {
+ $this->serverInfoLine = $this->serverIndex . ' (' . $host . ')';
+ }
+
+ return parent::Connect($host, $user, $pass, $db, $force_new, $retry);
+ }
+
+ /**
* Queries db with $sql query supplied
* and returns rows selected if any, false
* otherwise. Optional parameter $key_field
@@ -1100,7 +1131,7 @@
$first_cell = substr($first_cell, 0, 50) . ' ...';
}
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverInfoLine);
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
@@ -1113,7 +1144,7 @@
else {
// set 2nd checkpoint: begin
if ( $this->_profileSQLs ) {
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverInfoLine);
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
@@ -1170,7 +1201,7 @@
$first_cell = substr($first_cell, 0, 50) . ' ...';
}
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), $first_cell, $this->_queryCount, $this->nextQueryCachable, $this->serverInfoLine);
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
@@ -1181,7 +1212,7 @@
else {
// set 2nd checkpoint: begin
if ( $this->_profileSQLs ) {
- $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverIndex);
+ $debugger->profileFinish('sql_' . $queryID, null, null, $this->getAffectedRows(), null, $this->_queryCount, $this->nextQueryCachable, $this->serverInfoLine);
$debugger->profilerAddTotal('sql', 'sql_' . $queryID);
$this->nextQueryCachable = false;
}
Index: core/kernel/utility/debugger.php
===================================================================
--- core/kernel/utility/debugger.php (revision 15409)
+++ core/kernel/utility/debugger.php (working copy)
@@ -1244,7 +1244,7 @@
$this->ProfilerData[$key]['subtitle'] = 'cachable';
}
- if ( $func_arguments[7] ) {
+ if ( (string)$func_arguments[7] !== '' ) {
$additional[] = Array ('name' => 'Server #', 'value' => $func_arguments[7]);
}
Index: tools/debug_sample.php
===================================================================
--- tools/debug_sample.php (revision 15409)
+++ tools/debug_sample.php (working copy)
@@ -36,6 +36,7 @@
'DBG_SQL_PROFILE' => defined('IS_INSTALL') && IS_INSTALL ? 0 : 1, // Profile SQL queries
// 'DBG_SQL_EXPLAIN' => 1, // Explain every SQL query, that is retrieving data
'DBG_SQL_FAILURE' => isset($GLOBALS['pathtoroot']) && defined('IS_INSTALL') && IS_INSTALL ? 0 : 1, // treat sql errors as fatal errors except for installation process
+// 'DBG_SQL_SERVERINFO' => 1, // Display database server info next each sql query in debugger
'DBG_SHOW_HTTPQUERY' => 1, // Show http query content (parsed user submit, GPC)
'DBG_SHOW_SESSIONDATA' => 1, // Show session data (at script finish)
|