teiid SVN: r4651 - branches/7.7.x/build/kits/jboss-container.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2014-06-25 12:13:39 -0400 (Wed, 25 Jun 2014)
New Revision: 4651
Modified:
branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
Log:
BZ1054940 - Roll up patch EDS_5.3.1_1_2014 + TEIID-2945 + TEIID-2952 (revert from TEIID-2930)
Modified: branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-06-25 16:13:35 UTC (rev 4650)
+++ branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-06-25 16:13:39 UTC (rev 4651)
@@ -252,8 +252,6 @@
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-2921'>TEIID-2921</a>] - Allow the projection raising (or order pushing) logic to work with non-simple ordering expressions
</li>
-<li>[<a href='https://issues.jboss.org/browse/TEIID-2930'>TEIID-2930</a>] - SCROLL keyword for DECLARE CURSOR not being parsed correctly
-</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-2931'>TEIID-2931</a>] - Perform equi-join full outer joins in a streaming manner
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-2945'>TEIID-2945</a>] - disableLocalTxn only works at connection time
11 years, 6 months
teiid SVN: r4650 - in branches/7.7.x: test-integration/common/src/test/java/org/teiid/transport and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2014-06-25 12:13:35 -0400 (Wed, 25 Jun 2014)
New Revision: 4650
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:
Revert "TEIID-2930: SCROLL keyword for DECLARE CURSOR not being parsed correctly"
This reverts commit 31d017ae91be215a13c150580d02d6746ae25891.
Conflicts:
test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
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-06-25 16:13:30 UTC (rev 4649)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2014-06-25 16:13:35 UTC (rev 4650)
@@ -149,8 +149,8 @@
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 \"(\\w+)\" CURSOR(\\s(WITH HOLD|SCROLL))? FOR (.*)", 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$
@@ -250,46 +250,38 @@
}
}
- private void cursorExecute(String cursorName, final String sql, final ResultsFuture<Integer> completion, boolean scroll) {
- try {
- // close if the name is already used or the unnamed prepare; otherwise
- // stmt is alive until session ends.
- this.preparedMap.remove(UNNAMED);
- Portal p = this.portalMap.remove(UNNAMED);
- if (p != null) {
- closePortal(p);
- }
- if (cursorName == null || cursorName.length() == 0) {
- cursorName = UNNAMED;
- }
- Cursor cursor = cursorMap.get(cursorName);
- if (cursor != null) {
- errorOccurred("Cannot use the portal name " + cursorName + " until the exiting instance is closed.");
- return;
- }
-
- final PreparedStatementImpl stmt = this.connection.prepareStatement(sql, scroll?ResultSet.TYPE_SCROLL_INSENSITIVE:ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- this.executionFuture = stmt.submitExecute(ResultsMode.RESULTSET);
- final String name = cursorName;
- this.executionFuture.addCompletionListener(new ResultsFuture.CompletionListener<Boolean>() {
- @Override
- public void onCompletion(ResultsFuture<Boolean> future) {
- executionFuture = null;
- try {
- if (future.get()) {
- List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
- cursorMap.put(name, new Cursor(name, sql, stmt, null, stmt.getResultSet(), cols));
- client.sendCommandComplete("DECLARE CURSOR", null); //$NON-NLS-1$
- completion.getResultsReceiver().receiveResults(0);
- }
- } catch (Throwable e) {
- completion.getResultsReceiver().exceptionOccurred(e);
- }
- }
- });
- } catch (SQLException e) {
- completion.getResultsReceiver().exceptionOccurred(e);
- }
+ private void cursorExecute(final String cursorName, final String sql, final ResultsFuture<Integer> completion) {
+ if (sql != null) {
+ try {
+ // close if the name is already used or the unnamed prepare; otherwise
+ // stmt is alive until session ends.
+ Prepared previous = this.preparedMap.remove(cursorName);
+ if (previous != null) {
+ previous.stmt.close();
+ }
+
+ final PreparedStatementImpl stmt = this.connection.prepareStatement(sql);
+ this.executionFuture = stmt.submitExecute(ResultsMode.RESULTSET);
+ this.executionFuture.addCompletionListener(new ResultsFuture.CompletionListener<Boolean>() {
+ @Override
+ public void onCompletion(ResultsFuture<Boolean> future) {
+ executionFuture = null;
+ try {
+ if (future.get()) {
+ List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
+ cursorMap.put(cursorName, new Cursor(cursorName, sql, stmt, null, stmt.getResultSet(), cols));
+ client.sendCommandComplete("DECLARE CURSOR", null); //$NON-NLS-1$
+ completion.getResultsReceiver().receiveResults(0);
+ }
+ } catch (Throwable e) {
+ completion.getResultsReceiver().exceptionOccurred(e);
+ }
+ }
+ });
+ } catch (SQLException e) {
+ completion.getResultsReceiver().exceptionOccurred(e);
+ }
+ }
}
private void cursorFetch(String cursorName, int rows, final ResultsFuture<Integer> completion) throws SQLException {
@@ -796,23 +788,6 @@
}
}
}
-
- private void closePortal(Portal query) {
- ResultSet rs = query.rs;
- if (rs != null) {
- try {
- rs.close();
- } catch (SQLException e) {
- LogManager.logDetail(LogConstants.CTX_ODBC, e, "Did not successfully close portal", query.name); //$NON-NLS-1$
- }
- query.rs = null;
- }
- try {
- query.stmt.close();
- } catch (SQLException e) {
- LogManager.logDetail(LogConstants.CTX_ODBC, e, "Did not successfully close portal", query.name); //$NON-NLS-1$
- }
- }
@Override
public void closePreparedStatement(String preparedName) {
@@ -955,11 +930,7 @@
Matcher m = null;
if ((m = cursorSelectPattern.matcher(sql)).matches()){
- boolean scroll = false;
- if (m.group(2) != null && m.group(3) == null ) {
- scroll = true;
- }
- cursorExecute(m.group(1), fixSQL(m.group(4)), results, scroll);
+ cursorExecute(m.group(1), fixSQL(m.group(4)), results);
}
else if ((m = fetchPattern.matcher(sql)).matches()){
cursorFetch(m.group(2), Integer.parseInt(m.group(1)), results);
@@ -1093,8 +1064,6 @@
* The format used in the result set columns (if set).
*/
int[] resultColumnFormat;
-
- volatile ResultSetImpl rs;
/**
* The prepared statement.
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-06-25 16:13:30 UTC (rev 4649)
+++ branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-06-25 16:13:35 UTC (rev 4650)
@@ -50,7 +50,6 @@
import org.mockito.Mockito;
import org.postgresql.Driver;
import org.teiid.client.security.ILogon;
-//import org.postgresql.core.v3.ExtendedQueryExectutorImpl;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.FakeServer;
@@ -318,27 +317,6 @@
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 {
-// Statement stmt = conn.createStatement();
-// //ExtendedQueryExectutorImpl.simplePortal = "foo";
-// try {
-// assertFalse(stmt.execute("declare \"foo\" insensitive scroll cursor 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();
11 years, 6 months
teiid SVN: r4649 - in branches/7.7.x: test-integration/common/src/test/java/org/teiid/transport and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2014-06-25 12:13:30 -0400 (Wed, 25 Jun 2014)
New Revision: 4649
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:
Revert "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)"
This reverts commit b5027368deed19bed8b87103a284ab6f1886eed9.
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-06-25 16:13:24 UTC (rev 4648)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2014-06-25 16:13:30 UTC (rev 4649)
@@ -149,7 +149,8 @@
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+(?:WITH(?:OUT)? HOLD\\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+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-06-25 16:13:24 UTC (rev 4648)
+++ branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-06-25 16:13:30 UTC (rev 4649)
@@ -312,11 +312,12 @@
assertEquals("oid", rs.getArray("proargtypes").getBaseTypeName());
}
-// @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();
-// }
+ // 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();
+ }
// Introduces too many upstream dependencies, manual test against patched server needed.
// @Test public void testScrollCursor() throws Exception {
@@ -339,26 +340,6 @@
//
// }
-// 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')");
11 years, 6 months
teiid SVN: r4648 - in branches/7.7.x: runtime/src/main/java/org/teiid/odbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2014-06-25 12:13:24 -0400 (Wed, 25 Jun 2014)
New Revision: 4648
Modified:
branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ScriptReader.java
Log:
Revert "BZ1054940 - Roll up patch EDS_5.3.1_1_2014 + TEIID-2945 + TEIID-2952 + TEIID-2985 odbc script reader does not handle extra statement delimiters"
This reverts commit bae43cf42f1820f0af823d44d6b03dfc72c9ffc6.
Modified: branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-06-09 13:17:12 UTC (rev 4647)
+++ branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-06-25 16:13:24 UTC (rev 4648)
@@ -260,8 +260,6 @@
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-2952'>TEIID-2952</a>] - Crypto exception with client/server running on different java versions
</li>
-<li>[<a href='https://issues.jboss.org/browse/TEIID-2985'>TEIID-2985</a>] - odbc script reader does not handle extra statement delimiters
-</li>
</ul>
<h4>From 7.7.9</h4>
<ul>
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ScriptReader.java
===================================================================
--- branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ScriptReader.java 2014-06-09 13:17:12 UTC (rev 4647)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/odbc/ScriptReader.java 2014-06-25 16:13:24 UTC (rev 4648)
@@ -56,13 +56,7 @@
if (endOfFile) {
return null;
}
- while (true) {
- String result = readStatementLoop();
- if (result != null || endOfFile) {
- return result;
- }
- }
-
+ return readStatementLoop();
}
private String readStatementLoop() throws IOException {
11 years, 6 months