Fix debugging of procedures in EPAS packages. Fixes #3457

This commit is contained in:
Murtuza Zabuawala
2018-06-29 15:20:33 +01:00
committed by Dave Page
parent fb1ef9ac0b
commit b390c033cf
5 changed files with 81 additions and 11 deletions

View File

@@ -1240,6 +1240,8 @@ def execute_debugger_query(trans_id, query_type):
update_session_debugger_transaction(trans_id, session_obj)
status, result = conn.execute_async(sql)
if not status:
internal_server_error(errormsg=result)
return make_json_response(
data={'status': status, 'result': result}
)
@@ -1969,6 +1971,16 @@ def poll_end_execution_result(trans_id):
if statusmsg and statusmsg == 'SELECT 1':
statusmsg = ''
status, result = conn.poll()
if not status:
status = 'ERROR'
return make_json_response(
info=gettext("Execution completed with an error."),
data={
'status': status,
'status_message': result
}
)
session_function_data = session['functionData'][str(trans_id)]
if status == ASYNC_OK and \
not session_function_data['is_func'] and\
@@ -1996,7 +2008,7 @@ def poll_end_execution_result(trans_id):
if 'ERROR' in result:
status = 'ERROR'
return make_json_response(
info=gettext("Execution completed with error"),
info=gettext("Execution completed with an error."),
data={
'status': status,
'status_message': result
@@ -2084,7 +2096,9 @@ def poll_result(trans_id):
if conn.connected():
status, result = conn.poll()
if status == ASYNC_OK and result is not None:
if not status:
status = 'ERROR'
elif status == ASYNC_OK and result is not None:
status = 'Success'
columns, result = convert_data_to_dict(conn, result)
else:

View File

@@ -2,10 +2,11 @@ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'alertify', 'sources/pgadmin', 'pgadmin.browser',
'backbone', 'pgadmin.backgrid', 'codemirror', 'pgadmin.backform',
'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.browser.frame',
'pgadmin.tools.debugger.ui', 'pgadmin.tools.debugger.utils',
'wcdocker', 'pgadmin.browser.frame',
], function(
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
CodeMirror, Backform, get_function_arguments
CodeMirror, Backform, get_function_arguments, debuggerUtils
) {
var pgTools = pgAdmin.Tools = pgAdmin.Tools || {},
wcDocker = window.wcDocker;
@@ -337,7 +338,7 @@ define([
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.procedure._id,
'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
} else if (d._type == 'trigger_function') {
@@ -482,7 +483,7 @@ define([
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.procedure._id,
'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
}

View File

@@ -18,6 +18,19 @@ function setFocusToDebuggerEditor(editor, command) {
}
}
function getProcedureId(treeInfoObject) {
let objectId;
if(treeInfoObject) {
if (treeInfoObject.procedure && treeInfoObject.procedure._id) {
objectId = treeInfoObject.procedure._id;
} else if (treeInfoObject.edbproc && treeInfoObject.edbproc._id) {
objectId = treeInfoObject.edbproc._id;
}
}
return objectId;
}
module.exports = {
setFocusToDebuggerEditor: setFocusToDebuggerEditor,
getProcedureId: getProcedureId,
};