diff options
author | Marc G. Fournier <scrappy@hub.org> | 1998-12-14 05:19:16 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1998-12-14 05:19:16 +0000 |
commit | 7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c (patch) | |
tree | 77cf346913929743b747b012d14780fb369d7041 /src/backend/executor/spi.c | |
parent | f722af618a5d6cedb0e083397f6efcec2e07b0c8 (diff) | |
download | postgresql-7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c.tar.gz postgresql-7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c.zip |
Initial attempt to clean up the code...
Switch sprintf() to snprintf()
Remove any/all #if 0 -or- #ifdef NOT_USED -or- #ifdef FALSE sections of
code
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r-- | src/backend/executor/spi.c | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 0d3022dce70..125a36241ad 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -3,6 +3,8 @@ * spi.c-- * Server Programming Interface * + * $Id: spi.c,v 1.29 1998/12/14 05:18:51 scrappy Exp $ + * *------------------------------------------------------------------------- */ #include "executor/spi.h" @@ -43,10 +45,6 @@ typedef struct static int _SPI_execute(char *src, int tcount, _SPI_plan *plan); static int _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount); -#if 0 -static void _SPI_fetch(FetchStmt *stmt); - -#endif static int _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount); @@ -74,8 +72,8 @@ extern void ShowUsage(void); int SPI_connect() { - char pname[64]; - PortalVariableMemory pvmem; + char pname[64]; + PortalVariableMemory pvmem; /* * It's possible on startup and after commit/abort. In future we'll @@ -128,7 +126,7 @@ SPI_connect() _SPI_current->tuptable = NULL; /* Create Portal for this procedure ... */ - sprintf(pname, "<SPI %d>", _SPI_connected); + snprintf(pname, 64, "<SPI %d>", _SPI_connected); _SPI_current->portal = CreatePortal(pname); if (!PortalIsValid(_SPI_current->portal)) elog(FATAL, "SPI_connect: initialization failed"); @@ -876,46 +874,6 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount) } -#if 0 -static void -_SPI_fetch(FetchStmt *stmt) -{ - char *name = stmt->portalname; - int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK; - int count = stmt->howMany; - Portal portal; - QueryDesc *queryDesc; - EState *state; - MemoryContext context; - - if (name == NULL) - elog(FATAL, "SPI_fetch from blank portal unsupported"); - - portal = GetPortalByName(name); - if (!PortalIsValid(portal)) - elog(FATAL, "SPI_fetch: portal \"%s\" not found", name); - - context = MemoryContextSwitchTo((MemoryContext) PortalGetHeapMemory(portal)); - - queryDesc = PortalGetQueryDesc(portal); - state = PortalGetState(portal); - - ExecutorRun(queryDesc, state, feature, count); - - MemoryContextSwitchTo(context); /* switch to the normal Executor - * context */ - - _SPI_current->processed = state->es_processed; - if (_SPI_checktuples()) - elog(FATAL, "SPI_fetch: # of processed tuples check failed"); - - SPI_processed = _SPI_current->processed; - SPI_tuptable = _SPI_current->tuptable; - -} - -#endif - static MemoryContext _SPI_execmem() { |