>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> res = PQexecParams(conn,
PG> "SELECT * FROM testdata;",
PG> 0,
PG> NULL,
PG> NULL,
PG> NULL,
PG> NULL,
PG> 1);
That "1" on the end there indicates that you are requesting binary
format results. But this:
PG> std::cout << "value is: " << PQgetvalue(res, 0,0) << " length
PG> is: " << PQgetlength(res,0,0) << std::endl;
PG> REQUIRE(strcmp(PQgetvalue(res, 0,0), "1234") == 0);
is assuming text format.
The binary result for numeric '1234' will be 10 bytes long and consist
of: 00 01 00 00 00 00 00 00 04 d2:
0001 = ndigits (meaning: 1 base-10000 digit)
0000 = weight (first digit is * 10000^0)
0000 = sign (0 = positive)
0000 = dscale (0 base-10 digits after the point)
04d2 = decimal 1234
--
Andrew (irc:RhodiumToad)