Eneboo - Documentación para desarrolladores
src/libpq/include/utils/tuplestore.h
Ir a la documentación de este archivo.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * tuplestore.h
00004  *        Generalized routines for temporary tuple storage.
00005  *
00006  * This module handles temporary storage of tuples for purposes such
00007  * as Materialize nodes, hashjoin batch files, etc.  It is essentially
00008  * a dumbed-down version of tuplesort.c; it does no sorting of tuples
00009  * but can only store and regurgitate a sequence of tuples.  However,
00010  * because no sort is required, it is allowed to start reading the sequence
00011  * before it has all been written.      This is particularly useful for cursors,
00012  * because it allows random access within the already-scanned portion of
00013  * a query without having to process the underlying scan to completion.
00014  * A temporary file is used to handle the data if it exceeds the
00015  * space limit specified by the caller.
00016  *
00017  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
00018  * Portions Copyright (c) 1994, Regents of the University of California
00019  *
00020  * $PostgreSQL: pgsql/src/include/utils/tuplestore.h,v 1.16 2004/12/31 22:03:46 pgsql Exp $
00021  *
00022  *-------------------------------------------------------------------------
00023  */
00024 #ifndef TUPLESTORE_H
00025 #define TUPLESTORE_H
00026 
00027 #include "access/htup.h"
00028 
00029 /* Tuplestorestate is an opaque type whose details are not known outside
00030  * tuplestore.c.
00031  */
00032 typedef struct Tuplestorestate Tuplestorestate;
00033 
00034 /*
00035  * Currently we only need to store HeapTuples, but it would be easy
00036  * to support the same behavior for IndexTuples and/or bare Datums.
00037  */
00038 
00039 extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
00040                                           bool interXact,
00041                                           int maxKBytes);
00042 
00043 extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple);
00044 
00045 /* tuplestore_donestoring() used to be required, but is no longer used */
00046 #define tuplestore_donestoring(state)   ((void) 0)
00047 
00048 /* backwards scan is only allowed if randomAccess was specified 'true' */
00049 extern void *tuplestore_gettuple(Tuplestorestate *state, bool forward,
00050                                         bool *should_free);
00051 
00052 #define tuplestore_getheaptuple(state, forward, should_free) \
00053         ((HeapTuple) tuplestore_gettuple(state, forward, should_free))
00054 
00055 extern void tuplestore_end(Tuplestorestate *state);
00056 
00057 extern bool tuplestore_ateof(Tuplestorestate *state);
00058 
00059 extern void tuplestore_rescan(Tuplestorestate *state);
00060 extern void tuplestore_markpos(Tuplestorestate *state);
00061 extern void tuplestore_restorepos(Tuplestorestate *state);
00062 
00063 #endif   /* TUPLESTORE_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'