diff options
author | jakefeasel <jfeasel@gmail.com> | 2013-03-02 08:22:41 -0800 |
---|---|---|
committer | jakefeasel <jfeasel@gmail.com> | 2013-03-02 08:22:41 -0800 |
commit | 3d22308fbeb7706c337b3da06013b12a4657abce (patch) | |
tree | 4acd702cdc63192089374fef9989b62d7e2792c9 | |
parent | 900174b688c168fddb2137e0317ddea053a1b0f1 (diff) | |
download | sqlfiddle-3d22308fbeb7706c337b3da06013b12a4657abce.zip sqlfiddle-3d22308fbeb7706c337b3da06013b12a4657abce.tar.gz sqlfiddle-3d22308fbeb7706c337b3da06013b12a4657abce.tar.bz2 |
Further corrections to the display of "SQL too large" error messages
5 files changed, 122 insertions, 126 deletions
diff --git a/src/main/webapp/controllers/Fiddles.cfc b/src/main/webapp/controllers/Fiddles.cfc index 66ba721..3724ee7 100644 --- a/src/main/webapp/controllers/Fiddles.cfc +++ b/src/main/webapp/controllers/Fiddles.cfc @@ -160,7 +160,7 @@ component extends="Controller" { } catch (Any e) { - renderText(SerializeJSON({"error" = e.message})); + renderText(SerializeJSON({"sets": [{"SUCCEEDED" = false,"ERRORMESSAGE" = e.message}]})); } diff --git a/src/main/webapp/javascripts/fiddle_backbone/app.js b/src/main/webapp/javascripts/fiddle_backbone/app.js index 22d26bd..a16cae3 100644 --- a/src/main/webapp/javascripts/fiddle_backbone/app.js +++ b/src/main/webapp/javascripts/fiddle_backbone/app.js @@ -274,14 +274,17 @@ define([ query.on("executed", function () { var schemaDef = this.get("schemaDef"); - - myFiddleHistory.insert(new UsedFiddle({ - "fragment": "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id - })); - - router.navigate( - "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id - ); + + if (this.id) { + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id + })); + + router.navigate( + "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id + ); + } + }); diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/queryMarkdownOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/queryMarkdownOutput.html index 54a3ea5..6a42037 100644 --- a/src/main/webapp/javascripts/fiddle_backbone/templates/queryMarkdownOutput.html +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/queryMarkdownOutput.html @@ -1,4 +1,3 @@ -{{#if id}} Markdown is useful for posting on sites like <a href="http://stackoverflow.com" target="_new">StackOverflow</a> and <a href="http://dba.stackexchange.com" target="_new">dba.se</a>. Also, those sites are great resources for getting help with database questions! <pre class="results">[SQL Fiddle][1] @@ -25,5 +24,3 @@ Markdown is useful for posting on sites like <a href="http://stackoverflow.com" </pre> <span id="donationSuggestion">Did this query solve the problem? If so, consider donating $5 to help make sure SQL Fiddle will be here next time you need help with a database problem. Thanks!</span> - -{{/if}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html index 7c822b1..b03cab2 100644 --- a/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html @@ -1,58 +1,56 @@ - {{#if id}} - {{#each_with_index sets}} - <div class="set" id="set_{{index}}"> - {{#if this.RESULTS.DATA.length}} - <pre class="results"> +{{#each_with_index sets}} +<div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <pre class="results"> |{{#each_simple_value_with_index this.RESULTS.COLUMNS}} {{result_display_padded ../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}} -{{#each_simple_value_with_index this.RESULTS.COLUMNS}}-{{divider_display ../this/RESULTS/COLUMNWIDTHS}}--{{/each_simple_value_with_index}}{{#each this.RESULTS.DATA}} |{{#each_simple_value_with_index this}} {{result_display_padded ../../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}{{/each}} - </pre> - {{/if}} - {{#if this.SUCCEEDED}} - <div id="messages_{{index}}" class="alert alert-success database-messages"> - <i class="icon-ok"></i> - Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms - {{#if this.EXECUTIONPLAN.DATA.length}} - <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> - {{/if}} - <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> - </div> - - {{#if this.EXECUTIONPLAN.DATA.length}} - <table class="executionPlan table table-bordered"> - <tr> - {{#each this.EXECUTIONPLAN.COLUMNS}} - <th>{{this}}</th> - {{/each}} - </tr> - {{#each this.EXECUTIONPLAN.DATA}} - <tr> - {{#each this}} - <td><div style="position:relative">{{{this}}}</div></td> - {{/each}} - </tr> - {{/each}} - - {{#if ../../../schemaDef/dbType/isSQLServer}} - <tr> - <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td> - </tr> - {{/if}} - - {{#if ../../../schemaDef/dbType/isPostgreSQL}} - <tr> - <td><form action="http://explain.depesz.com/" target="_new"><input type="hidden" name="title" value="{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}"><input type="hidden" name="plan" value=""><input type="submit" class="btn btn-info depesz" value="View on Depesz"></form></td> - </tr> - {{/if}} + </pre> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> - </table> + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} + + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td> + </tr> {{/if}} - - {{else}} - <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + + {{#if ../../../schemaDef/dbType/isPostgreSQL}} + <tr> + <td><form action="http://explain.depesz.com/" target="_new"><input type="hidden" name="title" value="{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}"><input type="hidden" name="plan" value=""><input type="submit" class="btn btn-info depesz" value="View on Depesz"></form></td> + </tr> {{/if}} - </div> - {{/each_with_index}} - <span id="donationSuggestion">Did this query solve the problem? If so, consider donating $5 to help make sure SQL Fiddle will be here next time you need help with a database problem. Thanks!</span> + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> {{/if}} +</div> +{{/each_with_index}} + +<span id="donationSuggestion">Did this query solve the problem? If so, consider donating $5 to help make sure SQL Fiddle will be here next time you need help with a database problem. Thanks!</span> diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html index ae7a80e..ca0e8a6 100644 --- a/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html @@ -1,67 +1,65 @@ - {{#if id}} - {{#each_with_index sets}} - <div class="set" id="set_{{index}}"> - {{#if this.RESULTS.DATA.length}} - <table class="results table table-bordered table-striped"> - <tr> - {{#each this.RESULTS.COLUMNS}} - <th>{{this}}</th> - {{/each}} - </tr> - {{#each this.RESULTS.DATA}} - <tr> - {{#each this}} - <td>{{result_display this this}}</td> - {{/each}} - </tr> - {{/each}} - </table> - {{/if}} - {{#if this.SUCCEEDED}} - <div id="messages_{{index}}" class="alert alert-success database-messages"> - <i class="icon-ok"></i> - Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms - {{#if this.EXECUTIONPLAN.DATA.length}} - <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> - {{/if}} - <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> - </div> - - {{#if this.EXECUTIONPLAN.DATA.length}} - <table class="executionPlan table table-bordered"> - <tr> - {{#each this.EXECUTIONPLAN.COLUMNS}} - <th>{{this}}</th> - {{/each}} - </tr> - {{#each this.EXECUTIONPLAN.DATA}} - <tr> - {{#each this}} - <td><div style="position:relative">{{{this}}}</div></td> - {{/each}} - </tr> - {{/each}} +{{#each_with_index sets}} +<div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <table class="results table table-bordered table-striped"> + <tr> + {{#each this.RESULTS.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.RESULTS.DATA}} + <tr> + {{#each this}} + <td>{{result_display this this}}</td> + {{/each}} + </tr> + {{/each}} + </table> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> + + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} - {{#if ../../../schemaDef/dbType/isSQLServer}} - <tr> - <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td> - </tr> - {{/if}} + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td> + </tr> + {{/if}} - {{#if ../../../schemaDef/dbType/isPostgreSQL}} - <tr> - <td><form action="http://explain.depesz.com/" target="_new"><input type="hidden" name="title" value="{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}"><input type="hidden" name="plan" value=""><input type="submit" class="btn btn-info depesz" value="View on Depesz"></form></td> - </tr> - {{/if}} + {{#if ../../../schemaDef/dbType/isPostgreSQL}} + <tr> + <td><form action="http://explain.depesz.com/" target="_new"><input type="hidden" name="title" value="{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}"><input type="hidden" name="plan" value=""><input type="submit" class="btn btn-info depesz" value="View on Depesz"></form></td> + </tr> + {{/if}} - </table> - {{/if}} - - {{else}} - <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> - {{/if}} - </div> - {{/each_with_index}} - - <span id="donationSuggestion">Did this query solve the problem? If so, consider donating $5 to help make sure SQL Fiddle will be here next time you need help with a database problem. Thanks!</span> - {{/if}}
\ No newline at end of file + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + {{/if}} +</div> +{{/each_with_index}} + +<span id="donationSuggestion">Did this query solve the problem? If so, consider donating $5 to help make sure SQL Fiddle will be here next time you need help with a database problem. Thanks!</span> |