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

Function PQsendQueryPrepared

src/interfaces/libpq/fe-exec.c:1617–1653  ·  view source on GitHub ↗

* PQsendQueryPrepared * Like PQsendQuery, but execute a previously prepared statement, * using extended query protocol so we can pass parameters */

Source from the content-addressed store, hash-verified

1615 * using extended query protocol so we can pass parameters
1616 */
1617int
1618PQsendQueryPrepared(PGconn *conn,
1619 const char *stmtName,
1620 int nParams,
1621 const char *const *paramValues,
1622 const int *paramLengths,
1623 const int *paramFormats,
1624 int resultFormat)
1625{
1626 if (!PQsendQueryStart(conn, true))
1627 return 0;
1628
1629 /* check the arguments */
1630 if (!stmtName)
1631 {
1632 appendPQExpBufferStr(&conn->errorMessage,
1633 libpq_gettext("statement name is a null pointer\n"));
1634 return 0;
1635 }
1636 if (nParams < 0 || nParams > PQ_QUERY_PARAM_MAX_LIMIT)
1637 {
1638 appendPQExpBuffer(&conn->errorMessage,
1639 libpq_gettext("number of parameters must be between 0 and %d\n"),
1640 PQ_QUERY_PARAM_MAX_LIMIT);
1641 return 0;
1642 }
1643
1644 return PQsendQueryGuts(conn,
1645 NULL, /* no command to parse */
1646 stmtName,
1647 nParams,
1648 NULL, /* no param types */
1649 paramValues,
1650 paramLengths,
1651 paramFormats,
1652 resultFormat);
1653}
1654
1655/*
1656 * PQsendQueryStart

Callers 7

execute_foreign_modifyFunction · 0.85
test_pipelined_insertFunction · 0.85
test_transactionFunction · 0.85
test_uniqviolFunction · 0.85
PQexecPreparedFunction · 0.85
sendCommandFunction · 0.85

Calls 5

PQsendQueryStartFunction · 0.85
appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85
appendPQExpBufferFunction · 0.85
PQsendQueryGutsFunction · 0.85

Tested by 3

test_pipelined_insertFunction · 0.68
test_transactionFunction · 0.68
test_uniqviolFunction · 0.68