public inbox for [email protected]help / color / mirror / Atom feed
[Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node 3+ messages / 2 participants [nested] [flat]
* [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node @ 2016-10-07 10:55 Neel Patel <[email protected]> 2016-10-07 11:49 ` Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Dave Page <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Neel Patel @ 2016-10-07 10:55 UTC (permalink / raw) To: pgadmin-hackers Hi, Please find attached patch file which contains function/procedure debug support under package node. (RM #1577) Do review it and let me know for any comments. Thanks, Neel Patel -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM_1577.patch (11.0K, 3-RM_1577.patch) download | inline diff: diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index f7d0e7b..7d83ecb 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -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 diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js b/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js index 962c44b..8a8b14e 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js @@ -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; } diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js b/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js index b8ac3ca..97b9bfe 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js @@ -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, ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node 2016-10-07 10:55 [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Neel Patel <[email protected]> @ 2016-10-07 11:49 ` Dave Page <[email protected]> 2016-10-13 05:58 ` Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Neel Patel <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Dave Page @ 2016-10-07 11:49 UTC (permalink / raw) To: Neel Patel <[email protected]>; +Cc: pgadmin-hackers Thanks, applied. Couple of questions/points: - If there is no body for a procedure, the error is handled somewhat ungracefully - the message is displayed without line breaks, and the debugger panel is left empty. Can we make that a little nicer? - In pgAdmin 3 there's a "Debug package initialiser?" option on the parameter dialogue. Is that shown for appropriate packages? I don't have an example to hand to test with. On Fri, Oct 7, 2016 at 11:55 AM, Neel Patel <[email protected]> wrote: > Hi, > > Please find attached patch file which contains function/procedure debug > support under package node. (RM #1577) > > Do review it and let me know for any comments. > > Thanks, > Neel Patel > > > -- > Sent via pgadmin-hackers mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node 2016-10-07 10:55 [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Neel Patel <[email protected]> 2016-10-07 11:49 ` Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Dave Page <[email protected]> @ 2016-10-13 05:58 ` Neel Patel <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Neel Patel @ 2016-10-13 05:58 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, On Fri, Oct 7, 2016 at 5:19 PM, Dave Page <[email protected]> wrote: > Thanks, applied. Couple of questions/points: > > - If there is no body for a procedure, the error is handled somewhat > ungracefully - the message is displayed without line breaks, and the > debugger panel is left empty. Can we make that a little nicer? > OK, I will work on that. > > - In pgAdmin 3 there's a "Debug package initialiser?" option on the > parameter dialogue. Is that shown for appropriate packages? I don't > have an example to hand to test with. > Currently no option for "Debug package initialiser". I will submit updated patch for both above points. > > On Fri, Oct 7, 2016 at 11:55 AM, Neel Patel <[email protected]> > wrote: > > Hi, > > > > Please find attached patch file which contains function/procedure debug > > support under package node. (RM #1577) > > > > Do review it and let me know for any comments. > > > > Thanks, > > Neel Patel > > > > > > -- > > Sent via pgadmin-hackers mailing list ([email protected]) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgadmin-hackers > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-10-13 05:58 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-10-07 10:55 [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node Neel Patel <[email protected]> 2016-10-07 11:49 ` Dave Page <[email protected]> 2016-10-13 05:58 ` Neel Patel <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox