* PQsendQueryParams * Like PQsendQuery, but use extended query protocol so we can pass parameters */
| 1469 | * Like PQsendQuery, but use extended query protocol so we can pass parameters |
| 1470 | */ |
| 1471 | int |
| 1472 | PQsendQueryParams(PGconn *conn, |
| 1473 | const char *command, |
| 1474 | int nParams, |
| 1475 | const Oid *paramTypes, |
| 1476 | const char *const *paramValues, |
| 1477 | const int *paramLengths, |
| 1478 | const int *paramFormats, |
| 1479 | int resultFormat) |
| 1480 | { |
| 1481 | if (!PQsendQueryStart(conn, true)) |
| 1482 | return 0; |
| 1483 | |
| 1484 | /* check the arguments */ |
| 1485 | if (!command) |
| 1486 | { |
| 1487 | appendPQExpBufferStr(&conn->errorMessage, |
| 1488 | libpq_gettext("command string is a null pointer\n")); |
| 1489 | return 0; |
| 1490 | } |
| 1491 | if (nParams < 0 || nParams > PQ_QUERY_PARAM_MAX_LIMIT) |
| 1492 | { |
| 1493 | appendPQExpBuffer(&conn->errorMessage, |
| 1494 | libpq_gettext("number of parameters must be between 0 and %d\n"), |
| 1495 | PQ_QUERY_PARAM_MAX_LIMIT); |
| 1496 | return 0; |
| 1497 | } |
| 1498 | |
| 1499 | return PQsendQueryGuts(conn, |
| 1500 | command, |
| 1501 | "", /* use unnamed statement */ |
| 1502 | nParams, |
| 1503 | paramTypes, |
| 1504 | paramValues, |
| 1505 | paramLengths, |
| 1506 | paramFormats, |
| 1507 | resultFormat); |
| 1508 | } |
| 1509 | |
| 1510 | /* |
| 1511 | * PQsendPrepare |