@@ -249,7 +249,7 @@ EXEC SQL CONNECT TO :target USER :user USING :passwd;
249249 SQL statements in embedded SQL programs are by default executed on
250250 the current connection, that is, the most recently opened one. If
251251 an application needs to manage multiple connections, then there are
252- three ways to handle this.
252+ two ways to handle this.
253253 </para>
254254
255255 <para>
@@ -323,17 +323,6 @@ current=testdb2 (should be testdb2)
323323current=testdb1 (should be testdb1)
324324</screen>
325325 </para>
326-
327- <para>
328- The third option is to declare a SQL identifier linked to
329- the connection, for example:
330- <programlisting>
331- EXEC SQL AT <replaceable>connection-name</replaceable> DECLARE <replaceable>statement-name</replaceable> STATEMENT;
332- EXEC SQL PREPARE <replaceable>statement-name</replaceable> FROM :<replaceable>dyn-string</replaceable>;
333- </programlisting>
334- Once you link a SQL identifier to a connection, execute dynamic SQL
335- statements using this identifier without the <literal>AT</literal> clause.
336- </para>
337326 </sect2>
338327
339328 <sect2 id="ecpg-disconnect">
@@ -6820,189 +6809,6 @@ EXEC SQL DECLARE cur1 CURSOR FOR stmt1;
68206809 </refsect1>
68216810 </refentry>
68226811
6823- <refentry id="ecpg-sql-declare-statement">
6824- <refnamediv>
6825- <refname>DECLARE STATEMENT</refname>
6826- <refpurpose>declares a SQL statement identifier associated with connection</refpurpose>
6827- </refnamediv>
6828-
6829- <refsynopsisdiv>
6830- <synopsis>
6831- EXEC SQL [ AT <replaceable class="parameter">connection_name</replaceable> ] DECLARE <replaceable class="parameter">statement_name</replaceable> STATEMENT
6832- </synopsis>
6833- </refsynopsisdiv>
6834-
6835- <refsect1>
6836- <title>Description</title>
6837-
6838- <para>
6839- <command>DECLARE STATEMENT</command> declares a SQL statement identifier
6840- to be associated with connection.
6841- </para>
6842-
6843- <para>
6844- <command>DECLARE CURSOR</command> with an SQL statement identifier
6845- can be written before <command>PREPARE</command>.
6846- </para>
6847- </refsect1>
6848-
6849- <refsect1>
6850- <title>Parameters</title>
6851-
6852- <variablelist>
6853- <varlistentry>
6854- <term><replaceable class="parameter">connection_name</replaceable></term>
6855- <listitem>
6856- <para>
6857- A database connection name established by the <command>CONNECT</command> command.
6858- </para>
6859- <para>
6860- If the <literal>AT</literal> clause is omitted, the SQL statement
6861- identifier is associated with the <literal>DEFAULT</literal> connection.
6862- </para>
6863- </listitem>
6864- </varlistentry>
6865- </variablelist>
6866-
6867- <variablelist>
6868- <varlistentry>
6869- <term><replaceable class="parameter">statement_name</replaceable></term>
6870- <listitem>
6871- <para>
6872- The name of the SQL statement identifier, either as an SQL identifier
6873- or a host variable.
6874- </para>
6875- </listitem>
6876- </varlistentry>
6877- </variablelist>
6878- </refsect1>
6879-
6880- <refsect1>
6881- <title>Notes</title>
6882- <para>
6883- The <literal>AT</literal> clause can be used with both
6884- <command>DECLARE STATEMENT</command> and other dynamic SQL statements.
6885- The following table illustrates how it affects the selected database
6886- connection.
6887- </para>
6888- <table tocentry="1" id="ecpg-declare-statement-table">
6889- <title>Scenario</title>
6890- <tgroup cols="4">
6891- <thead>
6892- <row>
6893- <entry>
6894- Usage Scenario
6895- </entry>
6896- <entry>
6897- DECLARE STATEMENT
6898- </entry>
6899- <entry>
6900- Other Dynamic Statements
6901- </entry>
6902- <entry>
6903- Target Database
6904- </entry>
6905- </row>
6906- </thead>
6907- <tbody>
6908- <row>
6909- <entry>
6910- 1
6911- </entry>
6912- <entry>
6913- Without <literal>AT</literal>
6914- </entry>
6915- <entry>
6916- Without <literal>AT</literal>
6917- </entry>
6918- <entry>
6919- Default connection
6920- </entry>
6921- </row>
6922- <row>
6923- <entry>
6924- 2
6925- </entry>
6926- <entry>
6927- With <literal>AT</literal> that connects to <literal>con1</literal>
6928- </entry>
6929- <entry>
6930- Without <literal>AT</literal>
6931- </entry>
6932- <entry>
6933- con1
6934- </entry>
6935- </row>
6936- <row>
6937- <entry>
6938- 3
6939- </entry>
6940- <entry>
6941- With <literal>AT</literal> that connects to <literal>con1</literal>
6942- </entry>
6943- <entry>
6944- With <literal>AT</literal> that connects to <literal>con2</literal>
6945- </entry>
6946- <entry>
6947- con1
6948- </entry>
6949- </row>
6950- <row>
6951- <entry>
6952- 4
6953- </entry>
6954- <entry>
6955- Without <literal>AT</literal>
6956- </entry>
6957- <entry>
6958- With <literal>AT</literal> that connects to <literal>con2</literal>
6959- </entry>
6960- <entry>
6961- con2
6962- </entry>
6963- </row>
6964- </tbody>
6965- </tgroup>
6966- </table>
6967- <para>
6968- In scenario 4, <command>DECLARE STATEMENT</command> will be ignored.
6969- </para>
6970- </refsect1>
6971-
6972- <refsect1>
6973- <title>Examples</title>
6974-
6975- <programlisting>
6976- EXEC SQL CONNECT TO postgres AS con1;
6977- EXEC SQL AT con1 DECLARE sql_stmt STATEMENT;
6978- EXEC SQL DECLARE cursor_name CURSOR FOR sql_stmt;
6979- EXEC SQL PREPARE sql_stmt FROM :dyn_string;
6980- EXEC SQL OPEN cursor_name;
6981- EXEC SQL FETCH cursor_name INTO :column1;
6982- EXEC SQL CLOSE cursor_name;
6983- </programlisting>
6984- </refsect1>
6985-
6986- <refsect1>
6987- <title>Compatibility</title>
6988-
6989- <para>
6990- <command>DECLARE STATEMENT</command> is a PostgreSQL extension of the SQL standard,
6991- but can be used in Oracle and DB2.
6992- </para>
6993- </refsect1>
6994-
6995- <refsect1>
6996- <title>See Also</title>
6997-
6998- <simplelist type="inline">
6999- <member><xref linkend="ecpg-sql-connect"/></member>
7000- <member><xref linkend="ecpg-sql-declare"/></member>
7001- <member><xref linkend="ecpg-sql-open"/></member>
7002- </simplelist>
7003- </refsect1>
7004- </refentry>
7005-
70066812 <refentry id="ecpg-sql-describe">
70076813 <refnamediv>
70086814 <refname>DESCRIBE</refname>
0 commit comments