Author: jolee
Date: 2014-05-28 21:51:50 -0400 (Wed, 28 May 2014)
New Revision: 4646
Modified:
branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Log:
BZ1054940 - Roll up patch EDS_5.3.1_1_2014 + TEIID-2945 + TEIID-2952 + TEIID-2930: SCROLL
keyword for DECLARE CURSOR not being parsed correctly (reprise)
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
---
branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2014-05-29
01:51:44 UTC (rev 4645)
+++
branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2014-05-29
01:51:50 UTC (rev 4646)
@@ -149,8 +149,7 @@
private static Pattern preparedAutoIncrement = Pattern.compile("select 1 \\s*from
pg_catalog.pg_attrdef \\s*where adrelid = \\$1 AND adnum = \\$2 " + //$NON-NLS-1$
"\\s*and pg_catalog.pg_get_expr\\(adbin, adrelid\\) \\s*like
'%nextval\\(%'", Pattern.DOTALL|Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
-
- private static Pattern cursorSelectPattern =
Pattern.compile("DECLARE\\s+\"(\\w+)\"(?:\\s+INSENSITIVE)?(\\s+(NO\\s+)?SCROLL)?\\s+CURSOR\\s+FOR\\s+(.*)",
Pattern.CASE_INSENSITIVE|Pattern.DOTALL); //$NON-NLS-1$
+ private static Pattern cursorSelectPattern =
Pattern.compile("DECLARE\\s+\"(\\w+)\"(?:\\s+INSENSITIVE)?(\\s+(NO\\s+)?SCROLL)?\\s+CURSOR\\s+(?:WITH(?:OUT)?
HOLD\\s+)?FOR\\s+(.*)", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); //$NON-NLS-1$
private static Pattern fetchPattern = Pattern.compile("FETCH (\\d+) IN
\"(\\w+)\".*", Pattern.DOTALL|Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
private static Pattern movePattern = Pattern.compile("MOVE (\\d+) IN
\"(\\w+)\".*", Pattern.DOTALL|Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
private static Pattern closePattern = Pattern.compile("CLOSE
\"(\\w+)\"", Pattern.DOTALL|Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
Modified:
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
---
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-05-29
01:51:44 UTC (rev 4645)
+++
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-05-29
01:51:50 UTC (rev 4646)
@@ -312,12 +312,11 @@
assertEquals("oid", rs.getArray("proargtypes").getBaseTypeName());
}
- // this does not work as JDBC always sends the queries in prepared form
- public void testPgDeclareCursor() throws Exception {
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("begin;declare \"foo\" cursor for
select * from pg_proc;fetch 10 in \"foo\"; close \"foo\"");
- rs.next();
- }
+// @Test public void testCursor() throws Exception {
+// Statement stmt = conn.createStatement();
+// ResultSet rs = stmt.executeQuery("begin;declare \"foo\" cursor for
select * from pg_proc;fetch 10 in \"foo\"; close \"foo\"");
+// rs.next();
+// }
// Introduces too many upstream dependencies, manual test against patched server
needed.
// @Test public void testScrollCursor() throws Exception {
@@ -340,6 +339,26 @@
//
// }
+// Introduces too many upstream dependencies, manual test against patched server
needed.
+// @Test public void testScrollCursorWithHold() throws Exception {
+// Statement stmt = conn.createStatement();
+// ExtendedQueryExectutorImpl.simplePortal = "foo";
+// try {
+// assertFalse(stmt.execute("declare \"foo\" insensitive scroll cursor
with hold for select * from pg_proc;"));
+// assertFalse(stmt.execute("move 5 in \"foo\""));
+// stmt.execute("fetch 10 in \"foo\"");
+// ResultSet rs = stmt.getResultSet();
+// int rowCount = 0;
+// while (rs.next()) {
+// rowCount++;
+// }
+// assertEquals(6, rowCount);
+// stmt.execute("close \"foo\"");
+// } finally {
+// ExtendedQueryExectutorImpl.simplePortal = null;
+// }
+// }
+
@Test public void testPgProcedure() throws Exception {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select has_function_privilege(100,
'foo')");
Show replies by date