public inbox for [email protected]
help / color / mirror / Atom feedFrom: Neel Patel <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node
Date: Fri, 7 Oct 2016 16:25:01 +0530
Message-ID: <CACCA4P0pnDmhGhxs-0mQvLR4HRr+OinrJFg9m41oWmwkq4exKg@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-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,
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [Patch][pgAdmin4]: RM#1577 - Debug option for function/procedure under package node
In-Reply-To: <CACCA4P0pnDmhGhxs-0mQvLR4HRr+OinrJFg9m41oWmwkq4exKg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox