bug 780516 capitalizing keywords
This commit is contained in:
@@ -5,11 +5,15 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2004-04-19 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* sql.php: bug 780516: capitalizing keywords: we no longer
|
||||||
|
put the formatted query into $sql_query, due to better pattern matching
|
||||||
|
|
||||||
2004-04-19 Michal Cihar <michal@cihar.com>
|
2004-04-19 Michal Cihar <michal@cihar.com>
|
||||||
* libraries/tbl_change.js: Better return value formatting.
|
* libraries/tbl_change.js: Better return value formatting.
|
||||||
|
|
||||||
2004-04-18 Michal Cihar <michal@cihar.com>
|
2004-04-18 Michal Cihar <michal@cihar.com>
|
||||||
* libraries/tbl_change.js: Fixed caledar behaviour for DATE fields.
|
* libraries/tbl_change.js: Fixed calendar behaviour for DATE fields.
|
||||||
* libraries/auth/cookie.auth.lib.php: Fix LoginCookieValidity behaviour.
|
* libraries/auth/cookie.auth.lib.php: Fix LoginCookieValidity behaviour.
|
||||||
* libraries/tbl_change.js, tbl_change.php: Add support for DATETIME.
|
* libraries/tbl_change.js, tbl_change.php: Add support for DATETIME.
|
||||||
|
|
||||||
|
30
sql.php
30
sql.php
@@ -96,12 +96,25 @@ $parsed_sql = PMA_SQP_parse($sql_query);
|
|||||||
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
|
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
|
||||||
// Bug #641765 - Robbat2 - 12 January 2003, 10:49PM
|
// Bug #641765 - Robbat2 - 12 January 2003, 10:49PM
|
||||||
// Reverted - Robbat2 - 13 January 2003, 2:40PM
|
// Reverted - Robbat2 - 13 January 2003, 2:40PM
|
||||||
$sql_query = PMA_SQP_formatHtml($parsed_sql, 'query_only');
|
|
||||||
|
|
||||||
// old code did not work, for example, when there is a bracket
|
// lem9: for bug 780516: now that we use case insensitive preg_match
|
||||||
// before the SELECT
|
// or flags from the analyser, do not put back the reformatted query
|
||||||
// so I guess it's ok to check for a real SELECT ... FROM
|
// into $sql_query, to make this kind of query work without
|
||||||
//$is_select = eregi('^SELECT[[:space:]]+', $sql_query);
|
// capitalizing keywords:
|
||||||
|
//
|
||||||
|
// CREATE TABLE SG_Persons (
|
||||||
|
// id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
// first varchar(64) NOT NULL default '',
|
||||||
|
// PRIMARY KEY (`id`)
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// Note: now we probably do not need to fill and use $GLOBALS['unparsed_sql']
|
||||||
|
// but I let this intact for now.
|
||||||
|
//
|
||||||
|
//$sql_query = PMA_SQP_formatHtml($parsed_sql, 'query_only');
|
||||||
|
|
||||||
|
|
||||||
|
// check for a real SELECT ... FROM
|
||||||
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
|
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
|
||||||
|
|
||||||
// If the query is a Select, extract the db and table names and modify
|
// If the query is a Select, extract the db and table names and modify
|
||||||
@@ -181,8 +194,6 @@ if (!$cfg['Confirm']
|
|||||||
|| !empty($GLOBALS['validatequery'])) {
|
|| !empty($GLOBALS['validatequery'])) {
|
||||||
$do_confirm = FALSE;
|
$do_confirm = FALSE;
|
||||||
} else {
|
} else {
|
||||||
//$do_confirm = (eregi('DROP[[:space:]]+(IF[[:space:]]+EXISTS[[:space:]]+)?(TABLE|DATABASE[[:space:]])|ALTER[[:space:]]+TABLE[[:space:]]+((`[^`]+`)|([A-Za-z0-9_$]+))[[:space:]]+DROP[[:space:]]|DELETE[[:space:]]+FROM[[:space:]]', $sql_query));
|
|
||||||
|
|
||||||
$do_confirm = isset($analyzed_sql[0]['queryflags']['need_confirm']);
|
$do_confirm = isset($analyzed_sql[0]['queryflags']['need_confirm']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,10 +426,6 @@ else {
|
|||||||
|
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40000) {
|
if (PMA_MYSQL_INT_VERSION >= 40000) {
|
||||||
// add select expression after the SQL_CALC_FOUND_ROWS
|
// add select expression after the SQL_CALC_FOUND_ROWS
|
||||||
// if (eregi('DISTINCT(.*)', $sql_query)) {
|
|
||||||
// $count_query .= 'DISTINCT ' . $analyzed_sql[0]['select_expr_clause'];
|
|
||||||
// } else {
|
|
||||||
//$count_query .= $analyzed_sql[0]['select_expr_clause'];
|
|
||||||
|
|
||||||
// for UNION, just adding SQL_CALC_FOUND_ROWS
|
// for UNION, just adding SQL_CALC_FOUND_ROWS
|
||||||
// after the first SELECT works.
|
// after the first SELECT works.
|
||||||
@@ -431,7 +438,6 @@ else {
|
|||||||
|
|
||||||
// add everything that was after the first SELECT
|
// add everything that was after the first SELECT
|
||||||
$count_query .= PMA_SQP_formatHtml($parsed_sql, 'query_only', $analyzed_sql[0]['position_of_first_select']+1);
|
$count_query .= PMA_SQP_formatHtml($parsed_sql, 'query_only', $analyzed_sql[0]['position_of_first_select']+1);
|
||||||
// }
|
|
||||||
} else { // PMA_MYSQL_INT_VERSION < 40000
|
} else { // PMA_MYSQL_INT_VERSION < 40000
|
||||||
|
|
||||||
if (!empty($analyzed_sql[0]['from_clause'])) {
|
if (!empty($analyzed_sql[0]['from_clause'])) {
|
||||||
|
Reference in New Issue
Block a user