aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-09-20 12:47:21 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-09-20 12:47:37 -0400
commit96b6c82c9dd4a6a91c7e54bf42d36da111959ec6 (patch)
treeb4f489dd2f6504639cf4e5e521d184ed06041bb9 /doc/src
parentd1b0007639a1cefb5dcecf44999a4461f4c34089 (diff)
downloadpostgresql-96b6c82c9dd4a6a91c7e54bf42d36da111959ec6.tar.gz
postgresql-96b6c82c9dd4a6a91c7e54bf42d36da111959ec6.zip
Revert "Add DECLARE STATEMENT support to ECPG."
This reverts commit bd7c95f0c1a38becffceb3ea7234d57167f6d4bf, along with assorted follow-on fixes. There are some questions about the definition and implementation of that statement, and we don't have time to resolve them before v13 release. Rather than ship the feature and then have backwards-compatibility concerns constraining any redesign, let's remove it for now and try again later. Discussion: https://postgr.es/m/TY2PR01MB2443EC8286995378AEB7D9F8F5B10@TY2PR01MB2443.jpnprd01.prod.outlook.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ecpg.sgml196
1 files changed, 1 insertions, 195 deletions
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index c9d33fc19a8..d225eb3c20d 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -249,7 +249,7 @@ EXEC SQL CONNECT TO :target USER :user USING :passwd;
SQL statements in embedded SQL programs are by default executed on
the current connection, that is, the most recently opened one. If
an application needs to manage multiple connections, then there are
- three ways to handle this.
+ two ways to handle this.
</para>
<para>
@@ -323,17 +323,6 @@ current=testdb2 (should be testdb2)
current=testdb1 (should be testdb1)
</screen>
</para>
-
- <para>
- The third option is to declare a SQL identifier linked to
- the connection, for example:
-<programlisting>
-EXEC SQL AT <replaceable>connection-name</replaceable> DECLARE <replaceable>statement-name</replaceable> STATEMENT;
-EXEC SQL PREPARE <replaceable>statement-name</replaceable> FROM :<replaceable>dyn-string</replaceable>;
-</programlisting>
- Once you link a SQL identifier to a connection, execute dynamic SQL
- statements using this identifier without the <literal>AT</literal> clause.
- </para>
</sect2>
<sect2 id="ecpg-disconnect">
@@ -6820,189 +6809,6 @@ EXEC SQL DECLARE cur1 CURSOR FOR stmt1;
</refsect1>
</refentry>
- <refentry id="ecpg-sql-declare-statement">
- <refnamediv>
- <refname>DECLARE STATEMENT</refname>
- <refpurpose>declares a SQL statement identifier associated with connection</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
-<synopsis>
-EXEC SQL [ AT <replaceable class="parameter">connection_name</replaceable> ] DECLARE <replaceable class="parameter">statement_name</replaceable> STATEMENT
-</synopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para>
- <command>DECLARE STATEMENT</command> declares a SQL statement identifier
- to be associated with connection.
- </para>
-
- <para>
- <command>DECLARE CURSOR</command> with an SQL statement identifier
- can be written before <command>PREPARE</command>.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Parameters</title>
-
- <variablelist>
- <varlistentry>
- <term><replaceable class="parameter">connection_name</replaceable></term>
- <listitem>
- <para>
- A database connection name established by the <command>CONNECT</command> command.
- </para>
- <para>
- If the <literal>AT</literal> clause is omitted, the SQL statement
- identifier is associated with the <literal>DEFAULT</literal> connection.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-
- <variablelist>
- <varlistentry>
- <term><replaceable class="parameter">statement_name</replaceable></term>
- <listitem>
- <para>
- The name of the SQL statement identifier, either as an SQL identifier
- or a host variable.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>Notes</title>
- <para>
- The <literal>AT</literal> clause can be used with both
- <command>DECLARE STATEMENT</command> and other dynamic SQL statements.
- The following table illustrates how it affects the selected database
- connection.
- </para>
- <table tocentry="1" id="ecpg-declare-statement-table">
- <title>Scenario</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>
- Usage Scenario
- </entry>
- <entry>
- DECLARE STATEMENT
- </entry>
- <entry>
- Other Dynamic Statements
- </entry>
- <entry>
- Target Database
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- 1
- </entry>
- <entry>
- Without <literal>AT</literal>
- </entry>
- <entry>
- Without <literal>AT</literal>
- </entry>
- <entry>
- Default connection
- </entry>
- </row>
- <row>
- <entry>
- 2
- </entry>
- <entry>
- With <literal>AT</literal> that connects to <literal>con1</literal>
- </entry>
- <entry>
- Without <literal>AT</literal>
- </entry>
- <entry>
- con1
- </entry>
- </row>
- <row>
- <entry>
- 3
- </entry>
- <entry>
- With <literal>AT</literal> that connects to <literal>con1</literal>
- </entry>
- <entry>
- With <literal>AT</literal> that connects to <literal>con2</literal>
- </entry>
- <entry>
- con1
- </entry>
- </row>
- <row>
- <entry>
- 4
- </entry>
- <entry>
- Without <literal>AT</literal>
- </entry>
- <entry>
- With <literal>AT</literal> that connects to <literal>con2</literal>
- </entry>
- <entry>
- con2
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- In scenario 4, <command>DECLARE STATEMENT</command> will be ignored.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Examples</title>
-
-<programlisting>
-EXEC SQL CONNECT TO postgres AS con1;
-EXEC SQL AT con1 DECLARE sql_stmt STATEMENT;
-EXEC SQL DECLARE cursor_name CURSOR FOR sql_stmt;
-EXEC SQL PREPARE sql_stmt FROM :dyn_string;
-EXEC SQL OPEN cursor_name;
-EXEC SQL FETCH cursor_name INTO :column1;
-EXEC SQL CLOSE cursor_name;
-</programlisting>
- </refsect1>
-
- <refsect1>
- <title>Compatibility</title>
-
- <para>
- <command>DECLARE STATEMENT</command> is a PostgreSQL extension of the SQL standard,
- but can be used in Oracle and DB2.
- </para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
-
- <simplelist type="inline">
- <member><xref linkend="ecpg-sql-connect"/></member>
- <member><xref linkend="ecpg-sql-declare"/></member>
- <member><xref linkend="ecpg-sql-open"/></member>
- </simplelist>
- </refsect1>
- </refentry>
-
<refentry id="ecpg-sql-describe">
<refnamediv>
<refname>DESCRIBE</refname>