RE: Does PostgreSQL support Dynamic SQL?
От | Mike Mascari |
---|---|
Тема | RE: Does PostgreSQL support Dynamic SQL? |
Дата | |
Msg-id | 01C07E7F.AF09B810.mascarm@mascari.com обсуждение исходный текст |
Ответ на | Does PostgreSQL support Dynamic SQL? ("Lark" <litr@beer.com>) |
Ответы |
Re: Does PostgreSQL support Dynamic SQL?
|
Список | pgsql-general |
Its an extension to the embedded SQL preprocessor which allows you to dynamically build queries at run-time, instead of compile-time. So instead of having to declare the variables associated with query results at comile-time, like: EXEC SQL BEGIN DECLARE SECTION; VARCHAR userid[30]; VARCHAR password[30]; VARCHAR employee[30]; ... EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE SQLCA; and later performing a SELECT statement already defined in the C code like: EXEC SQL SELECT employeeid INTO :employee FROM employees; you can *dynamically* build a SELECT statement, ask the database for a description of the result sets' attributes, allocate the variables dynamically to hold the results, and then perform the FETCH. According to the man page for ecpg with version 7, there currently isn't support for the PREPARE statement, which is a prerequisite (along with DESCRIBE) for dynamic SQL queries. Perhaps Michael Meskes might be able to shed some more light on the status... Hope that helps, Mike Mascari mascarm@mascari.com -----Original Message----- From: The Hermit Hacker [SMTP:scrappy@hub.org] Stupid question, but what is Dynamic SQL? :) On Sun, 14 Jan 2001, Lark wrote: > Hi all! > 2 questions: > Does PostgreSQL support dynamic SQL, if so, when can i see any documents on > it at PostgreSQL.org? > thank's :) > > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
В списке pgsql-general по дате отправления: