camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: CAMEL-7803
Date Tue, 16 Sep 2014 12:59:36 GMT
Repository: camel
Updated Branches:
  refs/heads/master b8ca2bac1 -> 2b56df5b1


CAMEL-7803

 Patch added new boolean flag "preFetched" to allow inserts with parameters that have null
values


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9081ffac
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9081ffac
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9081ffac

Branch: refs/heads/master
Commit: 9081ffac08cace58cc1c7cd614eec50fc3317677
Parents: b8ca2ba
Author: nathanwray <nathanwray@users.noreply.github.com>
Authored: Thu Sep 11 11:57:09 2014 -0400
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Tue Sep 16 20:29:36 2014 +0800

----------------------------------------------------------------------
 .../DefaultJdbcPrepareStatementStrategy.java    | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9081ffac/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
index cceafae..b412ff2 100644
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
@@ -72,22 +72,21 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
                 return new Iterator<Object>() {
                     private NamedQueryParser parser = new NamedQueryParser(query);
                     private Object next;
-                    private boolean done;
+                    private boolean done = false;
+                    private boolean preFetched = false;
 
                     @Override
                     public boolean hasNext() {
-                        if (done) {
-                            return false;
+                        if (!done && !preFetched) {
+                            next();
+                            preFetched = true;
                         }
-                        if (next == null) {
-                            next = next();
-                        }
-                        return next != null;
+                        return (!done);
                     }
 
                     @Override
                     public Object next() {
-                        if (next == null) {
+                        if (!preFetched) {
                             String key = parser.next();
                             if (key == null) {
                                 done = true;
@@ -100,9 +99,8 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
                             }
                             next = headerMap.get(key);
                         }
-                        Object answer = next;
-                        next = null;
-                        return answer;
+                        preFetched = false;
+                        return next;
                     }
 
                     @Override


Mime
View raw message