From 96b6c82c9dd4a6a91c7e54bf42d36da111959ec6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 20 Sep 2019 12:47:21 -0400 Subject: 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 --- doc/src/sgml/ecpg.sgml | 196 +------------------------------------------------ 1 file changed, 1 insertion(+), 195 deletions(-) (limited to 'doc/src') 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. @@ -323,17 +323,6 @@ current=testdb2 (should be testdb2) current=testdb1 (should be testdb1) - - - The third option is to declare a SQL identifier linked to - the connection, for example: - -EXEC SQL AT connection-name DECLARE statement-name STATEMENT; -EXEC SQL PREPARE statement-name FROM :dyn-string; - - Once you link a SQL identifier to a connection, execute dynamic SQL - statements using this identifier without the AT clause. - @@ -6820,189 +6809,6 @@ EXEC SQL DECLARE cur1 CURSOR FOR stmt1; - - - DECLARE STATEMENT - declares a SQL statement identifier associated with connection - - - - -EXEC SQL [ AT connection_name ] DECLARE statement_name STATEMENT - - - - - Description - - - DECLARE STATEMENT declares a SQL statement identifier - to be associated with connection. - - - - DECLARE CURSOR with an SQL statement identifier - can be written before PREPARE. - - - - - Parameters - - - - connection_name - - - A database connection name established by the CONNECT command. - - - If the AT clause is omitted, the SQL statement - identifier is associated with the DEFAULT connection. - - - - - - - - statement_name - - - The name of the SQL statement identifier, either as an SQL identifier - or a host variable. - - - - - - - - Notes - - The AT clause can be used with both - DECLARE STATEMENT and other dynamic SQL statements. - The following table illustrates how it affects the selected database - connection. - - - Scenario - - - - - Usage Scenario - - - DECLARE STATEMENT - - - Other Dynamic Statements - - - Target Database - - - - - - - 1 - - - Without AT - - - Without AT - - - Default connection - - - - - 2 - - - With AT that connects to con1 - - - Without AT - - - con1 - - - - - 3 - - - With AT that connects to con1 - - - With AT that connects to con2 - - - con1 - - - - - 4 - - - Without AT - - - With AT that connects to con2 - - - con2 - - - - -
- - In scenario 4, DECLARE STATEMENT will be ignored. - -
- - - Examples - - -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; - - - - - Compatibility - - - DECLARE STATEMENT is a PostgreSQL extension of the SQL standard, - but can be used in Oracle and DB2. - - - - - See Also - - - - - - - -
- DESCRIBE -- cgit v1.2.3