From: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Michael Meskes <Michael(dot)Meskes(at)usa(dot)net> |
Cc: | PostgreSQL Hacker <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] preprocessor question: prepare statement |
Date: | 1999-02-04 02:47:20 |
Message-ID: | 36B90A38.339D6B16@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas G. Lockhart | 1999-02-04 02:52:41 | Re: [HACKERS] DEC OSF1 Compilation problems |
Previous Message | Bruce Momjian | 1999-02-04 02:12:55 | cleanup of optimizer |