39 #include <sys/types.h>
90 ival = ntohl(*((uint32_t *) iptr));
103 printf(
" i = (%d bytes) %d\n",
105 printf(
" t = (%d bytes) '%s'\n",
107 printf(
" b = (%d bytes) ", blen);
108 for (
j = 0;
j < blen;
j++)
117 const char *conninfo;
120 const char *paramValues[1];
123 uint32_t binaryIntVal;
133 conninfo =
"dbname = postgres";
167 paramValues[0] =
"joe's place";
170 "SELECT * FROM test1 WHERE t = $1",
200 binaryIntVal = htonl((uint32_t) 2);
203 paramValues[0] = (
char *) &binaryIntVal;
204 paramLengths[0] =
sizeof(binaryIntVal);
208 "SELECT * FROM test1 WHERE i = $1::int4",
static void PGresult * res
char * PQerrorMessage(const PGconn *conn)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
PGconn * PQconnectdb(const char *conninfo)
int PQgetlength(const PGresult *res, int tup_num, int field_num)
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
ExecStatusType PQresultStatus(const PGresult *res)
int PQntuples(const PGresult *res)
PGresult * PQexec(PGconn *conn, const char *query)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
int PQfnumber(const PGresult *res, const char *field_name)
static void exit_nicely(PGconn *conn)
int main(int argc, char **argv)
static void show_binary_results(PGresult *res)