Permalink
Browse files

Making SQL explain Javascript use POST instead of GET for getting que…

…ry logs.
  • Loading branch information...
1 parent 7deee0e commit 3e514de505149cf3a8bc079f4d8deb47dcf78281 @markstory markstory committed Apr 10, 2010
Showing with 14 additions and 3 deletions.
  1. +14 −3 views/elements/sql_log_panel.ctp
@@ -1,4 +1,4 @@
-=<?php
+<?php
/**
* SQL Log Panel Element
*
@@ -60,21 +60,32 @@ DEBUGKIT.sqlLog = function () {
return {
init : function () {
var sqlPanel = document.getElementById('sql_log-tab');
- var buttons = sqlPanel.getElementsByTagName('A');
+ var buttons = sqlPanel.getElementsByTagName('input');
// Button handling code for explain links.
// performs XHR request to get explain query.
var handleButton = function (event) {
event.preventDefault();
+ var data = {};
+ var inputs = this.form.getElementsByTagName('input');
+ var i = inputs.length;
+ while (i--) {
+ var input = inputs[i];
+ if (input.name) {
+ data[input.name] = input.value;
+ }
+ }
+
var fetch = new Request({
+ method: 'POST',
onComplete : function (response) {
var targetEl = document.getElementById('sql-log-explain-query');
targetEl.innerHTML = response.response.text;
},
onFail : function () {
alert('Could not fetch EXPLAIN for query.');
}
- }).send(this.href);
+ }).send(this.form.action, data);
};
Collection.apply(buttons, function (button) {

0 comments on commit 3e514de

Please sign in to comment.