Re: [HACKERS] preprocessor question: prepare statement

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] preprocessor question: prepare statement
Дата
Msg-id 36B90A38.339D6B16@alumni.caltech.edu
обсуждение исходный текст
Ответ на preprocessor question: prepare statement  (Michael Meskes <Michael.Meskes@usa.net>)
Ответы Re: [HACKERS] preprocessor question: prepare statement  (Michael Meskes <Michael_Meskes@topmail.de>)
Re: [HACKERS] preprocessor question: prepare statement  (Michael Meskes <Michael_Meskes@topmail.de>)
Список pgsql-hackers
> Could anyone tell me whether the EXEC SQL PREPARE statement is to be
> interpreted by the preprocessor or during run-time? That is can it be 
> placed outside a function? Does it have to stand above the DECLARE or 
> EXECUTE statement that references it or does it have to be executed 
> prior to this statement?
> The DECLARE statement AFAIK is to be processed by the preprocessor.
> Hopefully that one is correct too. :-)

Pretty sure that PREPARE is a run-time thing, since you can dynamically
build the sql statement fed to PREPARE.

In fact, looking at my Ingres docs:

"Dynamic SQL has four statements that are exclusively used in a dynamic
program: 'execute immediate', 'prepare', 'execute', and 'describe'."

In another section, it says:

"The 'prepare' statement tells the DBMS to encode the dynamically built
statement and assign it the specified name. After a statement is
prepared, the program can execute the statement one or more times within
a transaction by issuing the 'execute' statement and specifying the
statement name. This method improves performance if your program must
execute the same statement many times in a transaction. When you commit
a transaction, all statements that were prepared during the transaction
are discarded."

Hope this helps...
                      - Tom


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: cleanup of optimizer
Следующее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] DEC OSF1 Compilation problems