spi_prepare man page on SunOS

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
SunOS logo
[printable version]

SPI_prepare()		PostgreSQL 8.1.19 Documentation		 SPI_prepare()

NAME
       SPI_prepare - prepare a plan for a command, without executing it yet

SYNOPSIS
       void * SPI_prepare(const char * command, int nargs, Oid * argtypes)

DESCRIPTION
       SPI_prepare  creates  and  returns  an execution plan for the specified
       command but doesn't execute the command.	 This function should only  be
       called from a connected procedure.

       When the same or a similar command is to be executed repeatedly, it may
       be advantageous to perform the planning only  once.   SPI_prepare  con‐
       verts  a	 command  string  into	an execution plan that can be executed
       repeatedly using SPI_execute_plan.

       A prepared command can be generalized by writing	 parameters  ($1,  $2,
       etc.)  in  place	 of  what  would be constants in a normal command. The
       actual values of	 the  parameters  are  then  specified	when  SPI_exe‐
       cute_plan  is called.  This allows the prepared command to be used over
       a wider range of situations than would be possible without parameters.

       The plan returned by SPI_prepare can be used only in the current	 invo‐
       cation  of the procedure, since SPI_finish frees memory allocated for a
       plan.  But a plan can be saved for longer using the function  SPI_save‐
       plan.

ARGUMENTS
       const char * command
	      command string

       int nargs
	      number of input parameters ($1, $2, etc.)

       Oid * argtypes
	      pointer to an array containing the OIDs of the data types of the
	      parameters

RETURN VALUE
       SPI_prepare returns a non-null pointer to an execution plan. On	error,
       NULL  will  be  returned, and SPI_result will be set to one of the same
       error  codes  used  by  SPI_execute,  except  that   it	 is   set   to
       SPI_ERROR_ARGUMENT  if  command is NULL, or if nargs is less than 0, or
       if nargs is greater than 0 and argtypes is NULL.

NOTES
       There is a disadvantage to using parameters: since the planner does not
       know  the  values that will be supplied for the parameters, it may make
       worse planning choices than it would make for a normal command with all
       constants visible.

				  2009-12-09			 SPI_prepare()
[top]

List of man pages available for SunOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net