MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / messages

Function messages

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

messages(trans_id) This method polls the messages returned by the database server. Parameters: trans_id - unique transaction id.

(trans_id)

Source from the content-addressed store, hash-verified

1306)
1307@pga_login_required
1308def messages(trans_id):
1309 """
1310 messages(trans_id)
1311
1312 This method polls the messages returned by the database server.
1313
1314 Parameters:
1315 trans_id
1316 - unique transaction id.
1317 """
1318 de_inst = DebuggerInstance(trans_id)
1319 if de_inst.debugger_data is None:
1320 return make_json_response(
1321 data={
1322 'status': 'NotConnected',
1323 'result': SERVER_CONNECTION_CLOSED
1324 }
1325 )
1326
1327 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
1328 de_inst.debugger_data['server_id'])
1329 conn = manager.connection(
1330 did=de_inst.debugger_data['database_id'],
1331 conn_id=de_inst.debugger_data['conn_id'])
1332
1333 port_number = ''
1334
1335 if conn.connected():
1336 status = 'Busy'
1337 notify = conn.messages()
1338 if notify:
1339 # In notice message we need to find "PLDBGBREAK" string to find
1340 # the port number to attach.
1341 # Notice message returned by the server is
1342 # "NOTICE: PLDBGBREAK:7".
1343 # From the above message we need to find out port number
1344 # as "7" so below logic will find 7 as port number
1345 # and attach listened to that port number
1346 tmp_list = [x for x in notify if 'PLDBGBREAK' in x]
1347 if len(tmp_list) > 0:
1348 port_number = re.search(r'\d+', tmp_list[0])
1349 if port_number is not None:
1350 status = 'Success'
1351 port_number = port_number.group(0)
1352
1353 return make_json_response(
1354 data={'status': status, 'result': port_number}
1355 )
1356 else:
1357 result = SERVER_CONNECTION_CLOSED
1358 return internal_server_error(errormsg=str(result))
1359
1360
1361@blueprint.route(

Callers

nothing calls this directly

Calls 9

DebuggerInstanceClass · 0.90
make_json_responseFunction · 0.90
get_driverFunction · 0.90
internal_server_errorFunction · 0.90
connection_managerMethod · 0.80
connectionMethod · 0.80
searchMethod · 0.80
connectedMethod · 0.45
messagesMethod · 0.45

Tested by

no test coverage detected