Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
SPI_cursor_parse_open
Prev Up45.1. Interface FunctionsHome Next

SPI_cursor_parse_open

SPI_cursor_parse_open — set up a cursor using a query string and parameters

Synopsis

Portal SPI_cursor_parse_open(const char *name,                             const char *command,                             const SPIParseOpenOptions *options)

Description

SPI_cursor_parse_open sets up a cursor (internally, a portal) that will execute the specified query string. This is comparable toSPI_prepare_cursor followed bySPI_cursor_open_with_paramlist, except that parameter references within the query string are handled entirely by supplying aParamListInfo object.

For one-time query execution, this function should be preferred overSPI_prepare_cursor followed bySPI_cursor_open_with_paramlist. If the same command is to be executed with many different parameters, either method might be faster, depending on the cost of re-planning versus the benefit of custom plans.

Theoptions->params object should normally mark each parameter with thePARAM_FLAG_CONST flag, since a one-shot plan is always used for the query.

The passed-in parameter data will be copied into the cursor's portal, so it can be freed while the cursor still exists.

Arguments

const char *name

name for portal, orNULL to let the system select a name

const char *command

command string

const SPIParseOpenOptions *options

struct containing optional arguments

Callers should always zero out the entireoptions struct, then fill whichever fields they want to set. This ensures forward compatibility of code, since any fields that are added to the struct in future will be defined to behave backwards-compatibly if they are zero. The currently availableoptions fields are:

ParamListInfoparams

data structure containing query parameter types and values; NULL if none

intcursorOptions

integer bit mask of cursor options; zero produces default behavior

boolread_only

true for read-only execution

Return Value

Pointer to portal containing the cursor. Note there is no error return convention; any error will be reported viaelog.


Prev Up Next
SPI_cursor_open_with_paramlist Home SPI_cursor_find
pdfepub
Go to PostgreSQL 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp