Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: Makefile Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: dllist.c Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: dllist.o Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-auth.o Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-connect.o diff -u postgresql-6.5.2/src/interfaces/libpq/fe-exec.c postgresql-6.5.2-with-bind/src/interfaces/libpq/fe-exec.c --- postgresql-6.5.2/src/interfaces/libpq/fe-exec.c Thu May 27 21:54:53 1999 +++ postgresql-6.5.2-with-bind/src/interfaces/libpq/fe-exec.c Thu Oct 21 15:32:28 1999 @@ -869,19 +869,53 @@ vlen = vlen - 4; if (vlen < 0) vlen = 0; - if (tup[i].value == NULL) - { + if ((conn->tuple_destinations == NULL) || + (0==conn->tuple_destinations[i].len_max)) + { + + if (tup[i].value == NULL) + { tup[i].value = (char *) pqResultAlloc(result, vlen + 1, binary); if (tup[i].value == NULL) - goto outOfMemory; - } - tup[i].len = vlen; - /* read in the value */ - if (vlen > 0) - if (pqGetnchar((char *) (tup[i].value), vlen, conn)) + goto outOfMemory; + } + + /* read in the value */ + if (vlen > 0) + if (pqGetnchar((char *) (tup[i].value), vlen, conn)) + return EOF; + /* we have to terminate this ourselves */ + tup[i].value[vlen] = '\0'; + } + else + { + if (conn->tuple_destinations[i].len_max < vlen) + { + pqClearAsyncResult(conn); + sprintf(conn->errorMessage, + "getAnotherTuple() -- column %d is %d bytes larger than bound destination\n", i, vlen-conn->tuple_destinations[i].len_max); + conn->result = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR); + conn->asyncStatus = PGASYNC_READY; + /* Discard the broken message */ + conn->inStart = conn->inEnd; return EOF; - /* we have to terminate this ourselves */ - tup[i].value[vlen] = '\0'; + } + + /* we set length returned no matter what */ + *(conn->tuple_destinations[i].len_returned) = vlen; + + /* read in the value */ + if (vlen > 0) + { + if (pqGetnchar((char *) (conn->tuple_destinations[i].value), vlen, conn)) + return EOF; + + /* we only null terminate when there's space */ + if (conn->tuple_destinations[i].len_max > vlen) + conn->tuple_destinations[i].value[vlen] = '\0'; + } + } + tup[i].len = vlen; } /* advance the bitmap stuff */ bitcnt++; @@ -1921,4 +1955,18 @@ return 1; else return 0; +} + +void +PQsetResultDest(PGconn* conn, PGbinding* _dest) +{ + if (0==conn) return; + conn->tuple_destinations = _dest; +} + +void +PQclearResultDest(PGconn* conn) +{ + if (0==conn) return; + conn->tuple_destinations = 0; } Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-exec.c~ Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-exec.o Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-lobj.o Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-misc.o Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: fe-print.o diff -u postgresql-6.5.2/src/interfaces/libpq/libpq-fe.h postgresql-6.5.2-with-bind/src/interfaces/libpq/libpq-fe.h --- postgresql-6.5.2/src/interfaces/libpq/libpq-fe.h Tue May 25 12:15:13 1999 +++ postgresql-6.5.2-with-bind/src/interfaces/libpq/libpq-fe.h Thu Oct 21 15:37:04 1999 @@ -27,6 +27,13 @@ /* Application-visible enum types */ + typedef struct pgbinding + { + int len_max; /* [IN] length in bytes of the value buffer */ + int* len_returned; /* [OUT] pointer to int that receives bytes returned */ + char* value; /* [OUT] actual value returned */ + } PGbinding; + typedef enum { CONNECTION_OK, @@ -198,6 +205,10 @@ void *arg); /* === in fe-exec.c === */ + + /* result destinationn functions (for column binding and other things...)*/ + extern void PQsetResultDest(PGconn *conn, PGbinding* dest); + extern void PQclearResultDest(PGconn *conn); /* Simple synchronous query */ extern PGresult *PQexec(PGconn *conn, const char *query); Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq-fe.h~ diff -u postgresql-6.5.2/src/interfaces/libpq/libpq-int.h postgresql-6.5.2-with-bind/src/interfaces/libpq/libpq-int.h --- postgresql-6.5.2/src/interfaces/libpq/libpq-int.h Tue May 25 18:43:49 1999 +++ postgresql-6.5.2-with-bind/src/interfaces/libpq/libpq-int.h Thu Oct 21 15:34:36 1999 @@ -217,6 +217,9 @@ PGresult *result; /* result being constructed */ PGresAttValue *curTuple; /* tuple currently being read */ + /* optional column bind location */ + PGbinding *tuple_destinations; + /* Message space. Placed last for code-size reasons. */ char errorMessage[ERROR_MSG_LENGTH]; }; Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq-int.h~ Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq.a Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq.so Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq.so.2 Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: libpq.so.2.0 Only in postgresql-6.5.2-with-bind/src/interfaces/libpq: pqsignal.o