You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2020/10/07 12:11:27 UTC
[empire-db] branch master updated: EMPIREDB-333 fix parameter
propagation for nested params
This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push:
new 20a3b9d EMPIREDB-333 fix parameter propagation for nested params
20a3b9d is described below
commit 20a3b9de09c2a34ae18837b0d2f40367dbfe9195
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Wed Oct 7 14:11:19 2020 +0200
EMPIREDB-333 fix parameter propagation for nested params
---
.../src/main/java/org/apache/empire/db/DBReader.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBReader.java b/empire-db/src/main/java/org/apache/empire/db/DBReader.java
index a78de81..7906382 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBReader.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBReader.java
@@ -418,7 +418,7 @@ public class DBReader extends DBRecordData
String sqlCmd = cmd.getSelect();
// Collect the query parameters
Object[] paramValues = cmd.getParamValues();
- List<Object[]> subqueryParamValues = (cmd instanceof DBCommand) ? findSubQueryParams((DBCommand)cmd) : null;
+ List<Object> subqueryParamValues = (cmd instanceof DBCommand) ? findSubQueryParams((DBCommand)cmd) : null;
if (subqueryParamValues!=null && !subqueryParamValues.isEmpty())
{ // Check Count
if (paramValues==null)
@@ -905,9 +905,9 @@ public class DBReader extends DBRecordData
* @param cmd the command
* @return a list of parameter arrays, one for each subquery
*/
- protected List<Object[]> findSubQueryParams(DBCommand cmd)
+ protected List<Object> findSubQueryParams(DBCommand cmd)
{
- List<Object[]> subQueryParams = null;
+ List<Object> subQueryParams = null;
List<DBJoinExpr> joins = cmd.getJoins();
if (joins==null)
return null; // no joins
@@ -934,20 +934,21 @@ public class DBReader extends DBRecordData
* @param list the current list of parameters
* @return the new list of parameters
*/
- private List<Object[]> addSubQueryParams(DBQuery query, List<Object[]> list)
+ private List<Object> addSubQueryParams(DBQuery query, List<Object> list)
{
DBCommandExpr sqcmd = query.getCommandExpr();
Object[] params = query.getCommandExpr().getParamValues();
if (params!=null && params.length>0)
{ // add params
if (list== null)
- list = new ArrayList<Object[]>();
- list.add(params);
+ list = new ArrayList<Object>();
+ for (Object p : params)
+ list.add(p);
}
// recurse
if (sqcmd instanceof DBCommand)
{ // check this command too
- List<Object[]> sqlist = findSubQueryParams((DBCommand)sqcmd);
+ List<Object> sqlist = findSubQueryParams((DBCommand)sqcmd);
if (sqlist!=null && !sqlist.isEmpty())
{ // make one list
if (list!= null)