From 7413a31758136747ae61461772531db2afda5080 Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Tue, 1 Oct 2019 11:20:43 +0200 Subject: [PATCH] Fix update of newly created document using variables in a SQL batch script Resolves: #9000 --- .../orient/core/sql/executor/FetchFromVariableStep.java | 4 +++- .../orient/core/sql/executor/OInternalResultSet.java | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromVariableStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromVariableStep.java index 86e26a69e86..a25d0f0dc2c 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromVariableStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromVariableStep.java @@ -92,7 +92,9 @@ private void init() { } inited = true; Object src = ctx.getVariable(variableName); - if (src instanceof OResultSet) { + if(src instanceof OInternalResultSet){ + source = ((OInternalResultSet)src).copy(); + } else if (src instanceof OResultSet) { source = (OResultSet) src; source.reset(); } else if (src instanceof OElement) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInternalResultSet.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInternalResultSet.java index f294cdd98fc..b1a64c7ff1f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInternalResultSet.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInternalResultSet.java @@ -56,4 +56,10 @@ public void reset() { public int size() { return content.size(); } + + public OInternalResultSet copy() { + OInternalResultSet result = new OInternalResultSet(); + result.content = this.content; + return result; + } }