1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Add a new tuplestore API function, tuplestore_putvalues(). This is

identical to tuplestore_puttuple(), except it operates on arrays of
Datums + nulls rather than a fully-formed HeapTuple. In several places
that use the tuplestore API, this means we can avoid creating a
HeapTuple altogether, saving a copy.
This commit is contained in:
Neil Conway
2008-03-25 19:26:54 +00:00
parent 76cf067ae4
commit 1d812a98b4
7 changed files with 59 additions and 47 deletions

View File

@ -10,7 +10,7 @@
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.80 2008/01/01 19:45:49 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.81 2008/03/25 19:26:53 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -764,7 +764,6 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
hash_seq_init(&hash_seq, prepared_queries);
while ((prep_stmt = hash_seq_search(&hash_seq)) != NULL)
{
HeapTuple tuple;
Datum values[5];
bool nulls[5];
@ -787,11 +786,9 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
prep_stmt->plansource->num_params);
values[4] = BoolGetDatum(prep_stmt->from_sql);
tuple = heap_form_tuple(tupdesc, values, nulls);
/* switch to appropriate context while storing the tuple */
MemoryContextSwitchTo(per_query_ctx);
tuplestore_puttuple(tupstore, tuple);
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
}
}