Handle composite type return values properly in the debugger. Fixes #1662
parent
febb1b80b1
commit
f991354f9a
|
@ -1342,7 +1342,7 @@ def poll_end_execution_result(trans_id):
|
|||
|
||||
if conn.connected():
|
||||
statusmsg = conn.status_message()
|
||||
status, result, my_result = conn.poll()
|
||||
status, result, col_info = conn.poll()
|
||||
if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl':
|
||||
status = 'Success'
|
||||
return make_json_response(success=1, info=gettext("Execution Completed."),
|
||||
|
@ -1354,14 +1354,19 @@ def poll_end_execution_result(trans_id):
|
|||
data={'status': status, 'status_message': result})
|
||||
else:
|
||||
status = 'Success'
|
||||
data = {}
|
||||
for i in result:
|
||||
for k, v in i.items():
|
||||
data["name"] = k
|
||||
data.setdefault("value", []).append(v)
|
||||
columns = []
|
||||
# Check column info is available or not
|
||||
if col_info is not None and len(col_info) > 0:
|
||||
for col in col_info:
|
||||
items = list(col.items())
|
||||
column = dict()
|
||||
column['name'] = items[0][1]
|
||||
column['type_code'] = items[1][1]
|
||||
columns.append(column)
|
||||
|
||||
return make_json_response(success=1, info=gettext("Execution Completed."),
|
||||
data={'status': status, 'result': data, 'status_message': statusmsg})
|
||||
data={'status': status, 'result': result,
|
||||
'col_info': columns, 'status_message': statusmsg})
|
||||
else:
|
||||
status = 'Busy'
|
||||
else:
|
||||
|
|
|
@ -417,9 +417,9 @@ define(
|
|||
}
|
||||
else {
|
||||
// Call function to create and update local variables ....
|
||||
if (res.data.result.name != null) {
|
||||
if (res.data.result != null) {
|
||||
pgTools.DirectDebug.editor.removeLineClass(self.active_line_no, 'wrap', 'CodeMirror-activeline-background');
|
||||
self.AddResults(res.data.result);
|
||||
self.AddResults(res.data.col_info, res.data.result);
|
||||
pgTools.DirectDebug.results_panel.focus();
|
||||
pgTools.DirectDebug.direct_execution_completed = true;
|
||||
pgTools.DirectDebug.polling_timeout_idle = true;
|
||||
|
@ -846,7 +846,7 @@ define(
|
|||
|
||||
},
|
||||
|
||||
AddResults: function(result) {
|
||||
AddResults: function(columns, result) {
|
||||
var self = this;
|
||||
|
||||
// Remove the existing created grid and update the result values
|
||||
|
@ -866,22 +866,23 @@ define(
|
|||
model: DebuggerResultsModel
|
||||
});
|
||||
|
||||
resultGridCols = [
|
||||
{name: 'value', label:result.name, type:'text', editable: false, cell:'string'}
|
||||
];
|
||||
|
||||
var my_obj = [];
|
||||
if (result.value.length != 0)
|
||||
{
|
||||
for (i = 0; i < result.value.length; i++) {
|
||||
my_obj.push({ "value": result.value[i]});
|
||||
}
|
||||
var resultGridCols = [];
|
||||
if(_.size(columns)) {
|
||||
_.each(columns, function(c) {
|
||||
var column = {
|
||||
type:'text',
|
||||
editable: false,
|
||||
cell:'string'
|
||||
};
|
||||
column['name'] = column['label'] = c.name;
|
||||
resultGridCols.push(column);
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize a new Grid instance
|
||||
var result_grid = this.result_grid = new Backgrid.Grid({
|
||||
columns: resultGridCols,
|
||||
collection: new ResultsCollection(my_obj),
|
||||
collection: new ResultsCollection(result),
|
||||
className: "backgrid table-bordered"
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue