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

Function execute_debugger_query

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

execute_debugger_query(trans_id, query_type) This method is responsible to execute the query and return value. As this method is generic so user has to pass the query_type to get the required information for debugging. e.g. If user want to execute 'step_into' then query_type='

(trans_id, query_type)

Source from the content-addressed store, hash-verified

1208)
1209@pga_login_required
1210def execute_debugger_query(trans_id, query_type):
1211 """
1212 execute_debugger_query(trans_id, query_type)
1213
1214 This method is responsible to execute the query and return value. As this
1215 method is generic so user has to pass the query_type to get the required
1216 information for debugging.
1217
1218 e.g. If user want to execute 'step_into' then query_type='step_into'.
1219 If user want to execute 'continue' then query_type='continue'
1220
1221 Parameters:
1222 trans_id
1223 - Transaction ID
1224 query_type
1225 - Type of query to execute
1226 """
1227
1228 de_inst = DebuggerInstance(trans_id)
1229 if de_inst.debugger_data is None:
1230 return make_json_response(
1231 data={
1232 'status': False,
1233 'result': SERVER_CONNECTION_CLOSED
1234 }
1235 )
1236
1237 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
1238 de_inst.debugger_data['server_id'])
1239 conn = manager.connection(
1240 did=de_inst.debugger_data['database_id'],
1241 conn_id=de_inst.debugger_data['exe_conn_id'])
1242
1243 # find the debugger version and execute the query accordingly
1244 template_path = DEBUGGER_SQL_V1_PATH \
1245 if de_inst.debugger_data['debugger_version'] <= 2 \
1246 else DEBUGGER_SQL_V3_PATH
1247
1248 if not conn.connected():
1249 result = SERVER_CONNECTION_CLOSED
1250 return internal_server_error(errormsg=result)
1251
1252 sql = render_template(
1253 "/".join([template_path, query_type + ".sql"]),
1254 session_id=de_inst.debugger_data['session_id']
1255 )
1256 # As the query type is continue or step_into or step_over then we
1257 # may get result after some time so poll the result.
1258 # We need to update the frame id variable when user move the next
1259 # step for debugging.
1260 if query_type in ('continue', 'step_into', 'step_over'):
1261 # We should set the frame_id to 0 when execution starts.
1262 de_inst.debugger_data['frame_id'] = 0
1263 de_inst.update_session()
1264
1265 status, result = execute_async_search_path(
1266 conn, sql, de_inst.debugger_data['search_path'])
1267

Callers

nothing calls this directly

Calls 12

update_sessionMethod · 0.95
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