bug #1490556 Request-URI Too Large

This commit is contained in:
Sebastian Mendel
2006-06-20 17:58:14 +00:00
parent 58f1a2875c
commit 1b7b9673ac
4 changed files with 50 additions and 7 deletions

View File

@@ -12,6 +12,8 @@ $Source$
* themes/*/css/theme_right.css.php: bug #1449845 Nowrap in character sets
* libraries/common.lib.php::PMA_linkOrButton():
did not recognize hard coded & when ; is set as url separator in php
* js/querywindow.js, libraries/common.lib.php,
libraries/sql_query_form.lib.php: bug #1490556 Request-URI Too Large
2006-06-15 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sql_query_form.lib.php: Delimiter only if MySQL supports it

View File

@@ -1,5 +1,13 @@
/**
* holds the browser query window
*/
var querywindow = '';
/**
* holds the query to be load from a new query window
*/
var query_to_load = '';
/**
* sets current selected db
*
@@ -198,8 +206,19 @@ function reload_querywindow( db, table, sql_query ) {
}
}
/**
* brings query window to front and inserts query to be edited
*/
function focus_querywindow( sql_query ) {
if ( querywindow && !querywindow.closed && querywindow.location) {
/* if ( querywindow && !querywindow.closed && querywindow.location) { */
if ( !querywindow || querywindow.closed || !querywindow.location) {
// we need first to open the window and cannot pass the query with it
// as we dont know if the query exceeds max url length
/* url = 'querywindow.php?' + common_query + '&db=' + db + '&table=' + table + '&sql_query=SELECT * FROM'; */
query_to_load = sql_query;
open_querywindow();
insertQuery(0);
} else {
//var querywindow = querywindow;
if ( querywindow.document.querywindow.querydisplay_tab != 'sql' ) {
querywindow.document.querywindow.querydisplay_tab.value = "sql";
@@ -209,10 +228,21 @@ function focus_querywindow( sql_query ) {
} else {
querywindow.focus();
}
} else {
url = 'querywindow.php?' + common_query + '&db=' + db + '&table=' + table + '&sql_query=' + sql_query;
open_querywindow( url );
}
return true;
}
/**
* inserts query string into query window textarea
* called from script tag in querywindow
*/
function insertQuery() {
if (query_to_load != '' && querywindow.document && querywindow.document.getElementById && querywindow.document.getElementById('sqlquery')) {
querywindow.document.getElementById('sqlquery').value = query_to_load;
query_to_load = '';
return true;
}
return false;
}
function open_querywindow( url ) {

View File

@@ -1330,8 +1330,8 @@ if (!defined('PMA_MINIMUM_COMMON')) {
$a_string = str_replace('\\', '\\\\', $a_string);
$a_string = str_replace('\'', '\\\'', $a_string);
$a_string = str_replace('#', '\\#', $a_string);
$a_string = str_replace("\012", '\\\\n', $a_string);
$a_string = str_replace("\015", '\\\\r', $a_string);
$a_string = str_replace("\012", '\n', $a_string);
$a_string = str_replace("\015", '\r', $a_string);
}
return (($add_backquotes) ? PMA_backquote($a_string) : $a_string);
@@ -1556,7 +1556,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
&& (!empty($edit_target))) {
if ($cfg['EditInWindow'] == true) {
$onclick = 'window.parent.focus_querywindow(\'' . urlencode($local_query) . '\'); return false;';
$onclick = 'window.parent.focus_querywindow(\'' . PMA_jsFormat($local_query, false) . '\'); return false;';
} else {
$onclick = '';
}

View File

@@ -157,6 +157,17 @@ function PMA_sqlQueryForm($query = true, $display_tab = false)
}
echo '</form>' . "\n";
if ($is_querywindow) {
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
if (window.opener) {
window.opener.parent.insertQuery();
}
//]]>
</script>
<?php
}
}
/**