camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulli...@apache.org
Subject [09/50] git commit: CAMEL-7803
Date Fri, 17 Oct 2014 08:40:02 GMT
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/75c973a2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/75c973a2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/75c973a2

Branch: refs/remotes/origin/camel-2.13.x
Commit: 75c973a25e3a12d749dc7da8d5e6f3d92d15cc26
Parents: 543e3a5
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 21:04:43 2014 +0800

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


http://git-wip-us.apache.org/repos/asf/camel/blob/75c973a2/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