On Mon, Feb 13, 2017 Merlin Moncure wrote:
>A barebones callback mode ISTM is a complete departure from the classic PGresult interface. This code is pretty
unpleasantIMO:
acct->abalance = *((int*)PQgetvalue(res, 0, i)); abalance =
acct->__bswap_32(acct->abalance);
> Your code is faster but foists a lot of the work on the user, so it's kind of cheating in a way (although very
carefullywritten applications might be able to benefit).
The bit you call out above is for single row mode. Binary mode is a slippery slope, with or without the proposed
callback.
Let's remember that one of the biggest, often overlooked, gains when using an ORM is that it abstracts all this mess
away. The goal here is to prevent all the ORM/framework folks from having to implement protocol. Otherwise they get to
waiton libpq to copy from the socket to the PGconn buffer to the PGresult structure to their buffers. The callback
keepsthe slowest guy on the team...on the bench.
Kyle Gearhart