cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1490021 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
Date Wed, 05 Jun 2013 20:07:51 GMT
Author: aadamchik
Date: Wed Jun  5 20:07:51 2013
New Revision: 1490021

URL: http://svn.apache.org/r1490021
Log:
comments on PG functions behavior

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java?rev=1490021&r1=1490020&r2=1490021&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
Wed Jun  5 20:07:51 2013
@@ -88,8 +88,7 @@ public class DataContextProcedureQueryTe
 
         try {
             context.performGenericQuery(q);
-        }
-        finally {
+        } finally {
             Transaction.bindThreadTransaction(null);
             t.commit();
         }
@@ -124,8 +123,7 @@ public class DataContextProcedureQueryTe
 
         try {
             context.performGenericQuery(q);
-        }
-        finally {
+        } finally {
             Transaction.bindThreadTransaction(null);
             t.commit();
         }
@@ -202,9 +200,7 @@ public class DataContextProcedureQueryTe
         createArtist(1000.0);
 
         // test ProcedureQuery with Procedure as root
-        Procedure proc = context
-                .getEntityResolver()
-                .getProcedure(SELECT_STORED_PROCEDURE);
+        Procedure proc = context.getEntityResolver().getProcedure(SELECT_STORED_PROCEDURE);
         ProcedureQuery q = new ProcedureQuery(proc);
         q.addParameter("aName", "An Artist");
         q.addParameter("paintingPrice", new Integer(3000));
@@ -301,9 +297,7 @@ public class DataContextProcedureQueryTe
         assertEquals(1, rows.size());
         Object row = rows.get(0);
         assertNotNull(row);
-        assertTrue(
-                "Unexpected row class: " + row.getClass().getName(),
-                row instanceof Map<?, ?>);
+        assertTrue("Unexpected row class: " + row.getClass().getName(), row instanceof Map<?,
?>);
         Map<?, ?> outParams = (Map<?, ?>) row;
         Number price = (Number) outParams.get("out_param");
         assertNotNull("Null result... row content: " + row, price);
@@ -348,9 +342,7 @@ public class DataContextProcedureQueryTe
         createArtist(1000.0);
 
         // test ProcedureQuery with Procedure as root
-        Procedure proc = context
-                .getEntityResolver()
-                .getProcedure(SELECT_STORED_PROCEDURE);
+        Procedure proc = context.getEntityResolver().getProcedure(SELECT_STORED_PROCEDURE);
         ProcedureQuery q = new ProcedureQuery(proc);
         q.setFetchingDataRows(true);
         q.addParameter("aName", "An Artist");
@@ -383,18 +375,21 @@ public class DataContextProcedureQueryTe
     }
 
     protected List<DataRow> runProcedureSelect(ProcedureQuery q) throws Exception {
-        // Sybase blows whenever a transaction wraps a SP, so turn off transactions
+        // Sybase blows whenever a transaction wraps a SP, so turn off
+        // transactions
 
-        boolean transactionsFlag = context
-                .getParentDataDomain()
-                .isUsingExternalTransactions();
+        // TODO: it is quite the opposite with PostgreSQL. If an SP returns an
+        // open refcursor, it actually expects a TX in progress, so while we
+        // don't have refcursor unit tests, this is something to keep in mind
+        // e.g. http://stackoverflow.com/questions/16921942/porting-apache-cayenne-from-oracle-to-postgresql
+
+        boolean transactionsFlag = context.getParentDataDomain().isUsingExternalTransactions();
 
         context.getParentDataDomain().setUsingExternalTransactions(true);
 
         try {
             return context.performQuery(q);
-        }
-        finally {
+        } finally {
             context.getParentDataDomain().setUsingExternalTransactions(transactionsFlag);
         }
     }



Mime
View raw message