aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-05-09 18:08:48 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-05-09 18:08:48 +0000
commit0ac6298bb8ac11690cf3d4ad2537b4261ce93ab0 (patch)
tree6c224ba8d29078c7b343eaac0a4515a0257d661a /src/backend/tcop/postgres.c
parentd85a0a6bef965192df751532d38bbe8f4ec4ccd7 (diff)
downloadpostgresql-0ac6298bb8ac11690cf3d4ad2537b4261ce93ab0.tar.gz
postgresql-0ac6298bb8ac11690cf3d4ad2537b4261ce93ab0.zip
Implement new-protocol binary I/O support in DataRow, Bind, and FunctionCall
messages. Binary I/O is now up and working, but only for a small set of datatypes (integers, text, bytea).
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index dd235e8765a..f444302e965 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.341 2003/05/09 15:57:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.342 2003/05/09 18:08:48 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1342,8 +1342,21 @@ exec_bind_message(StringInfo input_message)
}
else if (pformat == 1)
{
- /* XXX something similar to above */
- elog(ERROR, "Binary BIND not implemented yet");
+ Oid typReceive;
+ Oid typElem;
+
+ /* Call the parameter type's binary input converter */
+ getTypeBinaryInputInfo(ptype, &typReceive, &typElem);
+
+ params[i].value =
+ OidFunctionCall2(typReceive,
+ PointerGetDatum(&pbuf),
+ ObjectIdGetDatum(typElem));
+
+ /* Trouble if it didn't eat the whole buffer */
+ if (pbuf.cursor != pbuf.len)
+ elog(ERROR, "Improper binary format in BIND parameter %d",
+ i + 1);
}
else
{
@@ -2511,7 +2524,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.341 $ $Date: 2003/05/09 15:57:24 $\n");
+ puts("$Revision: 1.342 $ $Date: 2003/05/09 18:08:48 $\n");
}
/*
@@ -2771,6 +2784,9 @@ PostgresMain(int argc, char *argv[], const char *username)
/* start an xact for this function invocation */
start_xact_command();
+ /* switch back to message context */
+ MemoryContextSwitchTo(MessageContext);
+
if (HandleFunctionRequest(input_message) == EOF)
{
/* lost frontend connection during F message input */