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

Function deposit_parameter_value

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

deposit_parameter_value(trans_id) This method is responsible to change the value of variables Parameters: trans_id - Transaction ID

(trans_id)

Source from the content-addressed store, hash-verified

1641)
1642@pga_login_required
1643def deposit_parameter_value(trans_id):
1644 """
1645 deposit_parameter_value(trans_id)
1646
1647 This method is responsible to change the value of variables
1648
1649 Parameters:
1650 trans_id
1651 - Transaction ID
1652 """
1653
1654 de_inst = DebuggerInstance(trans_id)
1655 if de_inst.debugger_data is None:
1656 return make_json_response(
1657 data={
1658 'status': False,
1659 'result': SERVER_CONNECTION_CLOSED
1660 }
1661 )
1662 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
1663 de_inst.debugger_data['server_id'])
1664 conn = manager.connection(
1665 did=de_inst.debugger_data['database_id'],
1666 conn_id=de_inst.debugger_data['exe_conn_id'])
1667
1668 # find the debugger version and execute the query accordingly
1669 dbg_version = de_inst.debugger_data['debugger_version']
1670 if dbg_version <= 2:
1671 template_path = DEBUGGER_SQL_V1_PATH
1672 else:
1673 template_path = DEBUGGER_SQL_V3_PATH
1674
1675 if conn.connected():
1676 # get the data sent through post from client
1677 data = json.loads(request.data)
1678
1679 if data:
1680 sql = render_template(
1681 "/".join([template_path, "deposit_value.sql"]),
1682 session_id=de_inst.debugger_data['session_id'],
1683 var_name=data[0]['name'], line_number=-1,
1684 val=data[0]['value'], conn=conn
1685 )
1686
1687 status, result = execute_dict_search_path(
1688 conn, sql, de_inst.debugger_data['search_path'])
1689 if not status:
1690 return internal_server_error(errormsg=result)
1691
1692 if result == BUSY:
1693 return make_json_response(
1694 data={'status': 'Busy', 'result': []}
1695 )
1696
1697 # Check if value deposited successfully or not and depending on
1698 # the result, return the message information.
1699 if result['rows'][0]['pldbg_deposit_value']:
1700 info = gettext('Value deposited successfully')

Callers

nothing calls this directly

Calls 10

DebuggerInstanceClass · 0.90
make_json_responseFunction · 0.90
get_driverFunction · 0.90
internal_server_errorFunction · 0.90
execute_dict_search_pathFunction · 0.85
gettextFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
joinMethod · 0.80
connectedMethod · 0.45

Tested by

no test coverage detected