* PQsendQueryPrepared * Like PQsendQuery, but execute a previously prepared statement, * using extended query protocol so we can pass parameters */
| 1615 | * using extended query protocol so we can pass parameters |
| 1616 | */ |
| 1617 | int |
| 1618 | PQsendQueryPrepared(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 |