details:   https://code.openbravo.com/erp/devel/pi/rev/537ed5d4a7f3
changeset: 16523:537ed5d4a7f3
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon May 14 10:46:16 2012 +0200
summary:   fixed issue 20484: Allow DAL call store procedure without flush

diffstat:

 src/org/openbravo/service/db/CallStoredProcedure.java |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r afdd6b12058b -r 537ed5d4a7f3 
src/org/openbravo/service/db/CallStoredProcedure.java
--- a/src/org/openbravo/service/db/CallStoredProcedure.java     Mon May 14 
08:11:10 2012 +0200
+++ b/src/org/openbravo/service/db/CallStoredProcedure.java     Mon May 14 
10:46:16 2012 +0200
@@ -62,9 +62,11 @@
    * @param types
    *          the list of types of the parameters, only needs to be set if 
there are null values and
    *          if the null value is something else than a String (which is 
handled as a default type)
+   * @param doFlush
+   *          do flush before calling stored procedure
    * @return the stored procedure result.
    */
-  public Object call(String name, List<Object> parameters, List<Class<?>> 
types) {
+  public Object call(String name, List<Object> parameters, List<Class<?>> 
types, boolean doFlush) {
     final StringBuilder sb = new StringBuilder();
     sb.append("SELECT " + name);
     for (int i = 0; i < parameters.size(); i++) {
@@ -79,7 +81,7 @@
       sb.append(")");
     }
     sb.append(" AS RESULT FROM DUAL");
-    final Connection conn = OBDal.getInstance().getConnection();
+    final Connection conn = OBDal.getInstance().getConnection(doFlush);
     try {
       final PreparedStatement ps = conn.prepareStatement(sb.toString(),
           ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
@@ -146,4 +148,8 @@
       throw new IllegalStateException("Type not supported, please add it here 
" + clz.getName());
     }
   }
+
+  public Object call(String name, List<Object> parameters, List<Class<?>> 
types) {
+    return call(name, parameters, types, true);
+  }
 }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to