should backquote the field named comment

This commit is contained in:
Marc Delisle
2003-02-06 17:49:29 +00:00
parent 49ce7d92ef
commit 338198dc83
5 changed files with 9 additions and 6 deletions

View File

@@ -7,6 +7,9 @@ $Source$
2003-02-06 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.lib.php3: PHP3 parse error
* Documentation.html, db_details_importdocsql.php3, tbl_relation.php3,
libraries/relation.lib.php3: bug 681298, we should always backquote
a restricted word like "comment" when used as an identifier
2003-02-05 Alexander M. Turek <rabus@users.sourceforge.net>
* db_details.php3, tbl_query_box.php3: Disabled the autoselect feature of

View File

@@ -769,7 +769,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db_name varchar(64) NOT NULL default '',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table_name varchar(64) NOT NULL default '',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column_name varchar(64) NOT NULL default '',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comment varchar(255) NOT NULL default '',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`comment` varchar(255) NOT NULL default '',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PRIMARY KEY (id),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UNIQUE KEY db_name (db_name, table_name, column_name)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;) TYPE=MyISAM COMMENT='Comments for Columns';<br />

View File

@@ -49,7 +49,7 @@ if (isset($do) && $do == 'import') {
$inf = explode('|',$line);
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
$qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_comments'])
. ' (db_name, table_name, column_name, comment) '
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\','
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\','

View File

@@ -297,7 +297,7 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
function PMA_getComments($db, $table) {
global $cfgRelation;
$com_qry = 'SELECT column_name, comment FROM ' . PMA_backquote($cfgRelation['column_comments'])
$com_qry = 'SELECT column_name, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_comments'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$com_rs = PMA_query_as_cu($com_qry);

View File

@@ -105,7 +105,7 @@ if ($cfgRelation['displaywork']
if ($cfgRelation['commwork']
&& isset($submit_comm) && $submit_comm == 'true') {
while (list($key, $value) = each($comment)) {
$test_qry = 'SELECT comment FROM ' . PMA_backquote($cfgRelation['column_comments'])
$test_qry = 'SELECT ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_comments'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_handleSlashes($key) . '\'';
@@ -113,7 +113,7 @@ if ($cfgRelation['commwork']
if ($test_rs && mysql_num_rows($test_rs) > 0) {
if (strlen($value) > 0) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_comments'])
. ' SET comment = \'' . PMA_handleSlashes($value) . '\''
. ' SET ' . PMA_backquote('comment') . ' = \'' . PMA_handleSlashes($value) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_handleSlashes($key) . '\'';
@@ -125,7 +125,7 @@ if ($cfgRelation['commwork']
}
} else if (strlen($value) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_comments'])
. ' (db_name, table_name, column_name, comment) '
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\','
. '\'' . PMA_sqlAddslashes($table) . '\','