MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / init_function

Function init_function

web/pgadmin/tools/debugger/__init__.py:384–514  ·  view source on GitHub ↗

init_function(node_type, sid, did, scid, fid, trid) This method is responsible to initialize the function required for debugging. This method is also responsible for storing the all functions data to session variable. This is only required for direct debugging. As Indirect

(node_type, sid, did, scid, fid, trid=None)

Source from the content-addressed store, hash-verified

382@permissions_required(AllPermissionTypes.tools_debugger)
383@pga_login_required
384def init_function(node_type, sid, did, scid, fid, trid=None):
385 """
386 init_function(node_type, sid, did, scid, fid, trid)
387
388 This method is responsible to initialize the function required for
389 debugging.
390 This method is also responsible for storing the all functions data to
391 session variable.
392 This is only required for direct debugging. As Indirect debugging does
393 not require these data because user will
394 provide all the arguments and other functions information through another
395 session to invoke the target.
396 It will also create a unique transaction id and store the information
397 into session variable.
398
399 Parameters:
400 node_type
401 - Node type - Function or Procedure
402 sid
403 - Server Id
404 did
405 - Database Id
406 scid
407 - Schema Id
408 fid
409 - Function Id
410 trid
411 - Trigger Function Id
412 """
413 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
414 conn = manager.connection(did=did)
415
416 # Get the server version, server type and user information
417 server_type = manager.server_type
418
419 # Check server type is ppas or not
420 ppas_server, is_proc_supported = check_server_type(server_type, manager)
421
422 is_error, err_msg, r_set, status = check_node_type(node_type, fid, trid,
423 conn, ppas_server,
424 is_proc_supported)
425 if is_error:
426 return err_msg
427
428 ret_status = status
429 msg = ''
430 # Check that the function is actually debuggable...
431 if r_set['rows'][0]:
432 # If func/proc is not defined in package body
433 # then it is not debuggable
434 if (r_set['rows'][0]['pkgname'] is not None or
435 r_set['rows'][0]['pkgname'] != '') and \
436 r_set['rows'][0]['prosrc'] == '':
437 ret_status = False
438 msg = r_set['rows'][0]['name'] + ' ' + \
439 gettext("is not defined in package body.")
440
441 # Function with a colon in the name cannot be debugged.

Callers

nothing calls this directly

Calls 11

get_driverFunction · 0.90
internal_server_errorFunction · 0.90
DebuggerInstanceClass · 0.90
make_json_responseFunction · 0.90
check_server_typeFunction · 0.85
check_node_typeFunction · 0.85
gettextFunction · 0.85
check_debugger_enabledFunction · 0.85
check_user_ip_reqFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80

Tested by

no test coverage detected