get all db comments at once, not with single queries
This commit is contained in:
@@ -270,15 +270,18 @@ require_once './libraries/List.class.php';
|
|||||||
{
|
{
|
||||||
$dbgroups = array();
|
$dbgroups = array();
|
||||||
$parts = array();
|
$parts = array();
|
||||||
|
|
||||||
|
if ($GLOBALS['cfg']['ShowTooltip']
|
||||||
|
&& $GLOBALS['cfgRelation']['commwork']) {
|
||||||
|
$db_tooltips = PMA_getDbComments();
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getLimitedItems($offset, $count) as $key => $db) {
|
foreach ($this->getLimitedItems($offset, $count) as $key => $db) {
|
||||||
// garvin: Get comments from PMA comments table
|
// garvin: Get comments from PMA comments table
|
||||||
$db_tooltip = '';
|
$db_tooltip = '';
|
||||||
if ($GLOBALS['cfg']['ShowTooltip']
|
|
||||||
&& $GLOBALS['cfgRelation']['commwork']) {
|
if (isset($db_tooltips[$db])) {
|
||||||
$_db_tooltip = PMA_getDbComment($db);
|
$db_tooltip = $_db_tooltips[$db];
|
||||||
if ($_db_tooltip) {
|
|
||||||
$db_tooltip = $_db_tooltip;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($GLOBALS['cfg']['LeftFrameDBTree']
|
if ($GLOBALS['cfg']['LeftFrameDBTree']
|
||||||
|
@@ -568,6 +568,48 @@ function PMA_getDbComment($db)
|
|||||||
return $comment;
|
return $comment;
|
||||||
} // end of the 'PMA_getDbComment()' function
|
} // end of the 'PMA_getDbComment()' function
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the comment for a db
|
||||||
|
*
|
||||||
|
* @author Mike Beck <mikebeck@users.sourceforge.net>
|
||||||
|
* @author lem9
|
||||||
|
* @access public
|
||||||
|
* @uses PMA_DBI_QUERY_STORE
|
||||||
|
* @uses PMA_DBI_num_rows()
|
||||||
|
* @uses PMA_DBI_fetch_assoc()
|
||||||
|
* @uses PMA_DBI_free_result()
|
||||||
|
* @uses PMA_getRelationsParam()
|
||||||
|
* @uses PMA_backquote()
|
||||||
|
* @uses PMA_sqlAddslashes()
|
||||||
|
* @uses PMA_query_as_cu()
|
||||||
|
* @uses strlen()
|
||||||
|
* @param string the name of the db to check for
|
||||||
|
* @return string comment
|
||||||
|
*/
|
||||||
|
function PMA_getDbComments()
|
||||||
|
{
|
||||||
|
$cfgRelation = PMA_getRelationsParam();
|
||||||
|
$comments = array();
|
||||||
|
|
||||||
|
if ($cfgRelation['commwork']) {
|
||||||
|
// pmadb internal db comment
|
||||||
|
$com_qry = "
|
||||||
|
SELECT `db_name`, `comment`
|
||||||
|
FROM " . PMA_backquote($cfgRelation['db']) . "." . PMA_backquote($cfgRelation['column_info']) . "
|
||||||
|
WHERE `column_name` = '(db_comment)'";
|
||||||
|
$com_rs = PMA_query_as_cu($com_qry, true, PMA_DBI_QUERY_STORE);
|
||||||
|
|
||||||
|
if ($com_rs && PMA_DBI_num_rows($com_rs) > 0) {
|
||||||
|
while ($row = PMA_DBI_fetch_assoc($com_rs)) {
|
||||||
|
$comments[$row['db_name']] = $row['comment'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PMA_DBI_free_result($com_rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $comments;
|
||||||
|
} // end of the 'PMA_getDbComments()' function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a database comment to a certain value.
|
* Set a database comment to a certain value.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user