* pqPutMsgEnd: finish constructing a message and possibly send it * * Returns 0 on success, EOF on error * * We don't actually send anything here unless we've accumulated at least * 8K worth of data (the typical size of a pipe buffer on Unix systems). * This avoids sending small partial packets. The caller must use pqFlush * when it's important to flush all the data out to the server. */
| 587 | * when it's important to flush all the data out to the server. |
| 588 | */ |
| 589 | int |
| 590 | pqPutMsgEnd(PGconn *conn) |
| 591 | { |
| 592 | pqPutMsgEndNoAutoFlush(conn); |
| 593 | |
| 594 | if (conn->outCount >= 8192) |
| 595 | { |
| 596 | int toSend = conn->outCount - (conn->outCount % 8192); |
| 597 | |
| 598 | if (pqSendSome(conn, toSend) < 0) |
| 599 | return EOF; |
| 600 | /* in nonblock mode, don't complain if unable to send it all */ |
| 601 | } |
| 602 | |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | /* ---------- |
| 607 | * pqReadData: read more data, if any is available |
no test coverage detected