MCPcopy Create free account
hub / github.com/apache/cloudberry / exec_bind_message

Function exec_bind_message

src/backend/tcop/postgres.c:2365–2845  ·  view source on GitHub ↗

* exec_bind_message * * Process a "Bind" message to create a portal from a prepared statement */

Source from the content-addressed store, hash-verified

2363 * Process a "Bind" message to create a portal from a prepared statement
2364 */
2365static void
2366exec_bind_message(StringInfo input_message)
2367{
2368 const char *portal_name;
2369 const char *stmt_name;
2370 int numPFormats;
2371 int16 *pformats = NULL;
2372 int numParams;
2373 int numRFormats;
2374 int16 *rformats = NULL;
2375 CachedPlanSource *psrc;
2376 CachedPlan *cplan;
2377 Portal portal;
2378 char *query_string;
2379 char *saved_stmt_name;
2380 ParamListInfo params;
2381 MemoryContext oldContext;
2382 bool save_log_statement_stats = log_statement_stats;
2383 bool snapshot_set = false;
2384 char msec_str[32];
2385 ParamsErrorCbData params_data;
2386 ErrorContextCallback params_errcxt;
2387
2388 /* Get the fixed part of the message */
2389 portal_name = pq_getmsgstring(input_message);
2390 stmt_name = pq_getmsgstring(input_message);
2391
2392 elog((Debug_print_full_dtm ? LOG : DEBUG5), "Bind: portal %s stmt_name %s", portal_name, stmt_name);
2393
2394 ereport(DEBUG2,
2395 (errmsg_internal("bind %s to %s",
2396 *portal_name ? portal_name : "<unnamed>",
2397 *stmt_name ? stmt_name : "<unnamed>")));
2398
2399 /* Find prepared statement */
2400 if (stmt_name[0] != '\0')
2401 {
2402 PreparedStatement *pstmt;
2403
2404 pstmt = FetchPreparedStatement(stmt_name, true);
2405 psrc = pstmt->plansource;
2406 }
2407 else
2408 {
2409 /* special-case the unnamed statement */
2410 psrc = unnamed_stmt_psrc;
2411 if (!psrc)
2412 ereport(ERROR,
2413 (errcode(ERRCODE_UNDEFINED_PSTATEMENT),
2414 errmsg("unnamed prepared statement does not exist")));
2415 }
2416
2417 /*
2418 * Report query to various monitoring facilities.
2419 */
2420 debug_query_string = psrc->query_string;
2421
2422 pgstat_report_activity(STATE_RUNNING, psrc->query_string);

Callers 1

PostgresMainFunction · 0.85

Calls 15

pq_getmsgstringFunction · 0.85
FetchPreparedStatementFunction · 0.85
pgstat_report_activityFunction · 0.85
set_ps_displayFunction · 0.85
ResetUsageFunction · 0.85
start_xact_commandFunction · 0.85
MemoryContextSwitchToFunction · 0.85
pq_getmsgintFunction · 0.85
IsTransactionExitStmtFunction · 0.85
errdetail_abortFunction · 0.85
CreatePortalFunction · 0.85

Tested by

no test coverage detected