Allow debugging of functions and procedures in packages on EPAS. Fixes #1577

This commit is contained in:
Neel Patel
2016-10-07 12:46:34 +01:00
committed by Dave Page
parent 3963272523
commit 4e86345c28
3 changed files with 88 additions and 8 deletions

View File

@@ -163,6 +163,10 @@ def init_function(node_type, sid, did, scid, fid, trid=None):
fid = tr_set['rows'][0]['tgfoid']
# if ppas server and node type is edb function or procedure then extract last argument as function id
if node_type == 'edbfunc' or node_type == 'edbproc':
fid = trid
sql = ''
sql = render_template("/".join([template_path, 'get_function_debug_info.sql']), is_ppas_database=ppas_server,
hasFeatureFunctionDefaults=True, fid=fid)
@@ -259,6 +263,7 @@ def init_function(node_type, sid, did, scid, fid, trid=None):
'arg_mode': r_set['rows'][0]['proargmodes'],
'use_default': r_set['rows'][0]['pronargdefaults'],
'default_value': r_set['rows'][0]['proargdefaults'],
'pkgname': r_set['rows'][0]['pkgname'],
'pkg': r_set['rows'][0]['pkg'],
'require_input': data['require_input'],
'args_value': ''
@@ -454,6 +459,7 @@ def initialize_target(debug_type, sid, did, scid, func_id, tri_id=None):
'arg_mode': func_data['arg_mode'],
'use_default': func_data['use_default'],
'default_value': func_data['default_value'],
'pkgname': func_data['pkgname'],
'pkg': func_data['pkg'],
'require_input': func_data['require_input'],
'args_value': func_data['args_value']
@@ -631,9 +637,15 @@ def start_debugger_listener(trans_id):
if obj['debug_type'] == 'direct':
str_query = ''
# Form the function name with schema name
func_name = driver.qtIdent(conn, session['functionData'][str(trans_id)]['schema']) + '.' + driver.qtIdent(
conn, session['functionData'][str(trans_id)]['name'])
if session['functionData'][str(trans_id)]['pkg'] == 0:
# Form the function name with schema name
func_name = driver.qtIdent(conn, session['functionData'][str(trans_id)]['schema']) + '.' + driver.qtIdent(
conn, session['functionData'][str(trans_id)]['name'])
else:
# Form the edb package function/procedure name with schema name
func_name = driver.qtIdent(conn, session['functionData'][str(trans_id)]['schema']) + '.' + \
driver.qtIdent(conn, session['functionData'][str(trans_id)]['pkgname']) + '.' + \
driver.qtIdent(conn, session['functionData'][str(trans_id)]['name'])
if obj['restart_debug'] == 0:
# render the SQL template and send the query to server

View File

@@ -58,6 +58,30 @@ define(
priority: 10, label: '{{ _('Set breakpoint') }}', category: 'Debugging',
icon: 'fa fa-arrow-circle-right', data: {object:'trigger'},
enable: 'can_debug'
}, {
name: 'package_function_direct_debugger', node: 'edbfunc', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'package_function_global_debugger', node: 'edbfunc', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'package_procedure_direct_debugger', node: 'edbproc', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}, {
name: 'package_procedure_global_debugger', node: 'edbproc', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}]);
// Create and load the new frame required for debugger panel
@@ -102,7 +126,9 @@ define(
return false;
// For trigger node, language will be undefined - we should allow indirect debugging for trigger node
if (d_.language == undefined && d_._type == 'trigger') {
if ((d_.language == undefined && d_._type == 'trigger') ||
(d_.language == undefined && d_._type == 'edbfunc') ||
(d_.language == undefined && d_._type == 'edbproc')) {
return true;
}

View File

@@ -150,11 +150,21 @@ define(
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
}
else {
else if (d._type == "procedure") {
// Get the existing function parameters available from sqlite database
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
}
else if (d._type == "edbfunc") {
// Get the existing function parameters available from sqlite database
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
}
else if (d._type == "edbproc") {
// Get the existing function parameters available from sqlite database
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
}
}
else {
// Get the existing function parameters available from sqlite database
@@ -471,12 +481,26 @@ define(
}
if (self.restart_debug == 0) {
var f_id;
if (d._type == "function") {
f_id = treeInfo.function._id;
}
else if (d._type == "procedure") {
f_id = treeInfo.procedure._id;
}
else if (d._type == "edbfunc") {
f_id = treeInfo.edbfunc._id;
}
else if (d._type == "edbproc") {
f_id = treeInfo.edbproc._id;
}
// Below will format the data to be stored in sqlite database
sqlite_func_args_list.push({
'server_id': treeInfo.server._id,
'database_id': treeInfo.database._id,
'schema_id': treeInfo.schema._id ,
'function_id': d._type == "function" ? treeInfo.function._id : treeInfo.procedure._id,
'function_id': f_id,
'arg_id': self.input_arg_id[int_count],
'is_null': m.get('is_null') ? 1 : 0,
'is_expression': m.get('expr') ? 1 : 0,
@@ -508,10 +532,18 @@ define(
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
}
else {
else if (d._type == "procedure") {
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
}
else if (d._type == "edbfunc") {
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
}
else if (d._type == "edbproc") {
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
}
$.ajax({
url: baseUrl,
@@ -549,10 +581,20 @@ define(
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
}
else {
else if (d._type == "procedure") {
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
}
else if (d._type == "edbfunc") {
// Get the existing function parameters available from sqlite database
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
}
else if (d._type == "edbproc") {
// Get the existing function parameters available from sqlite database
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
}
$.ajax({
url: _Url,