From dad70b66d913ee1b0cac4ce3e7bd8bbff1728ada Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Sat, 17 Sep 2011 15:54:27 +0100 Subject: [PATCH 1/3] Fixed broken retreival of triggers for a specific table --- libraries/database_interface.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 709e15fc74..f0520a762c 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -1603,12 +1603,12 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//') // Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html // their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this // instead of WHERE EVENT_OBJECT_SCHEMA='dbname' - $query = "SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddSlashes($db,true) . "';"; + $query = "SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddSlashes($db) . "'"; if (! empty($table)) { - $query .= " AND EVENT_OBJECT_TABLE = '" . PMA_sqlAddSlashes($table, true) . "';"; + $query .= " AND EVENT_OBJECT_TABLE = '" . PMA_sqlAddSlashes($table) . "';"; } } else { - $query = "SHOW TRIGGERS FROM " . PMA_backquote(PMA_sqlAddSlashes($db,true)); + $query = "SHOW TRIGGERS FROM " . PMA_backquote($db); if (! empty($table)) { $query .= " LIKE '" . PMA_sqlAddSlashes($table, true) . "';"; } From 7b4bb1c8657c1de0f9564fd0929ca0a0eaa515b3 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 17 Sep 2011 21:46:57 +0530 Subject: [PATCH 2/3] Coding style improvements --- tbl_zoom_select.php | 200 ++++++++++++++++++++++++++------------------ 1 file changed, 119 insertions(+), 81 deletions(-) diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index cf8a64f90c..a110ace4b7 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -37,13 +37,14 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js'; if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) { $extra_data = array(); - $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause']; - $result = PMA_DBI_query( $row_info_query . ";" , null, PMA_DBI_QUERY_STORE); + $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' + . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause']; + $result = PMA_DBI_query($row_info_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) { $extra_data['row_info'] = $row; } - PMA_ajaxResponse(NULL, true, $extra_data); + PMA_ajaxResponse(null, true, $extra_data); } $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaThemeImage); @@ -83,7 +84,7 @@ $foreigners = PMA_getForeigners($db, $table); $flag = 1; $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array(); if (! isset($zoom_submit) && ! isset($inputs)) { - $dataLabel = PMA_getDisplayField($db,$table); + $dataLabel = PMA_getDisplayField($db, $table); } ?>
@@ -114,7 +115,8 @@ if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) { */ ?> -
> +> @@ -135,28 +137,29 @@ for ($i = 0; $i < 4; $i++) { echo __("Additional search criteria"); echo ""; } -?> + ?> - - - - - + + + - - - - - + + + + - + - - + - + + - @@ -250,7 +260,7 @@ for ($i = 0; $i < 4; $i++) { //Set default datalabel if not selected if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') { if ($dataLabel == '') { - $dataLabel = PMA_getDisplayField($db,$table); + $dataLabel = PMA_getDisplayField($db, $table); } } ?> @@ -261,13 +271,15 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') - - + + - - + + @@ -321,8 +333,14 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' $cnt_func = count($zoomFunc[$i]); $func_type = $zoomFunc[$i]; list($charsets[$i]) = explode('_', $collations[$i]); - $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false; - $whereClause = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag); + $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) + && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) + ? true + : false; + $whereClause = PMA_tbl_search_getWhereClause( + $fields[$i], $inputs[$i], $types[$i], + $collations[$i], $func_type, $unaryFlag + ); if ($whereClause) { $w[] = $whereClause; } @@ -335,7 +353,7 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' /* * Query execution part */ - $result = PMA_DBI_query($sql_query . ";" , null, PMA_DBI_QUERY_STORE); + $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) { //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array @@ -349,81 +367,101 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' //Append it to row array as where_clause $row['where_clause'] = $uniqueCondition[0]; if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + 'where_clause' => $uniqueCondition[0] + ); } elseif ($dataLabel) { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => $row[$dataLabel], 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + $dataLabel => $row[$dataLabel], + 'where_clause' => $uniqueCondition[0] + ); } else { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => '', 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + $dataLabel => '', + 'where_clause' => $uniqueCondition[0] + ); } } /* * Form for displaying point data and also the scatter plot */ -?> - > + ?> + >
- -
- +
+ -
-
- +
+
+ -
-
+ - +
- - From 4581e53735ac67e609ac4f4ff06db25e4b70849d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 17 Sep 2011 21:57:10 +0530 Subject: [PATCH 3/3] bug #3410984 - Zoom search, checkboxes and fields not being reset --- js/tbl_zoom_plot.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index 788ca6396c..df73c3c60f 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -469,10 +469,12 @@ $(document).ready(function() { }; $.post('tbl_zoom_select.php', post_params, function(data) { // Row is contained in data.row_info, now fill the displayResultForm with row values - for ( key in data.row_info) { + for (key in data.row_info) { if (data.row_info[key] == null) { $('#fields_null_id_' + fid).attr('checked', true); + $('#fieldID_' + fid).val(''); } else { + $('#fields_null_id_' + fid).attr('checked', false); $('#fieldID_' + fid).val(data.row_info[key]); } fid++;