Author: shawkins
Date: 2010-08-13 08:06:36 -0400 (Fri, 13 Aug 2010)
New Revision: 2459
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java
Log:
TEIID-1206 fix for npe
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-08-12
17:32:44 UTC (rev 2458)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-08-13
12:06:36 UTC (rev 2459)
@@ -355,7 +355,7 @@
}
processor = request.processor;
resultsBuffer = processor.createTupleBuffer();
- if (this.cid != null) {
+ if (this.cid != null && originalCommand.getCacheHint() != null) {
resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
}
collector = new BatchCollector(processor, resultsBuffer) {
Modified:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java 2010-08-12
17:32:44 UTC (rev 2458)
+++
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java 2010-08-13
12:06:36 UTC (rev 2459)
@@ -44,7 +44,7 @@
conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
//$NON-NLS-2$
}
- @Test public void testCache() throws Exception {
+ @Test public void testCacheHint() throws Exception {
Statement s = conn.createStatement();
s.execute("set showplan on");
ResultSet rs = s.executeQuery("/* cache */ select 1");
@@ -56,4 +56,18 @@
assertFalse(rs.next());
}
+ @Test public void testExecutionProperty() throws Exception {
+ Statement s = conn.createStatement();
+ s.execute("set showplan on");
+ s.execute("set resultSetCacheMode true");
+ ResultSet rs = s.executeQuery("select 1");
+ assertTrue(rs.next());
+ s.execute("set noexec on");
+ rs = s.executeQuery("select 1");
+ assertTrue(rs.next());
+ s.execute("set resultSetCacheMode false");
+ rs = s.executeQuery("select 1");
+ assertFalse(rs.next());
+ }
+
}
Show replies by date