empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Semenov (JIRA)" <empire-db-...@incubator.apache.org>
Subject [jira] [Commented] (EMPIREDB-244) Add support of WITH clause fo oracle and postgresql
Date Tue, 21 Jun 2016 07:18:58 GMT

    [ https://issues.apache.org/jira/browse/EMPIREDB-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341276#comment-15341276
] 

Pavel Semenov commented on EMPIREDB-244:
----------------------------------------

Index: src/main/java/org/apache/empire/db/DBQuery.java
===================================================================
--- src/main/java/org/apache/empire/db/DBQuery.java	(revision 128817)
+++ src/main/java/org/apache/empire/db/DBQuery.java	(revision 128816)
@@ -60,8 +60,6 @@
  */
 public class DBQuery extends DBRowSet {
 	private final static long serialVersionUID = 1L;
-	
-	private String withName;
 
 	public static class DBQueryColumn extends DBColumn {
 		private final static long serialVersionUID = 1L;
@@ -330,13 +328,9 @@
 	 */
 	@Override
 	public void addSQL(StringBuilder buf, long context) {
-		if (withName != null && !withName.isEmpty()) {
-			buf.append(withName);
-		} else {
-			buf.append("(");
-			buf.append(cmdExpr.getSelect());
-			buf.append(")");
-		}
+		buf.append("(");
+		buf.append(cmdExpr.getSelect());
+		buf.append(")");
 		// Add Alias
 		if ((context & CTX_ALIAS) != 0 && alias != null) { // append alias
 			buf.append(" ");
@@ -641,11 +635,4 @@
 		throw new NotImplementedException(this, "deleteRecord()");
 	}
 
-	public void setWithName(String withName) {
-		this.withName = withName;
-	}
-	
-	public String getWithName() {
-		return withName;
-	}
 }
\ No newline at end of file
Index: src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java
===================================================================
--- src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java	(revision 128817)
+++ src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java	(revision 128816)
@@ -19,9 +19,7 @@
 package org.apache.empire.db.oracle;
 
 // Imports
-import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
 import org.apache.empire.commons.StringUtils;
@@ -30,7 +28,6 @@
 import org.apache.empire.db.DBCommand;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBIndex;
-import org.apache.empire.db.DBQuery;
 import org.apache.empire.db.DBRowSet;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.expr.compare.DBCompareExpr;
@@ -56,7 +53,6 @@
 	// protected OracleRowNumExpr rowNumExpr = null;
 	protected int limitRows = -1;
 	protected int skipRows = 0;
-	protected List<DBQuery> withQueries = new ArrayList<DBQuery>();;
 
 	/**
 	 * Constructs an oracle command object.
@@ -159,19 +155,6 @@
 		resetParamUsage();
 		if (select == null)
 			throw new ObjectNotValidException(this);
-		// with command
-		for (int i = 0; i < withQueries.size(); i ++) {
-			DBQuery query = withQueries.get(i);
-			if (i == 0) {
-				buf.append("WITH ");
-			} else {
-				buf.append(",");
-			}
-			buf.append(query.getWithName()).append(" as (");
-//			withQuery.addSQL(buf, CTX_DEFAULT | CTX_ALIAS); // Is context correct?
-			buf.append(query.getCommandExpr().getSelect());
-			buf.append(")\r\n");
-		}
 		// limit rows
 		boolean usePreparedStatements = isPreparedStatementsEnabled();
 		if (limitRows >= 0) { // add limitRows and skipRows wrapper
@@ -383,15 +366,5 @@
 		}
 		return buf.toString();
 	}
-	
-	public DBQuery addWithCommand(DBCommand withCommand) {
-		DBQuery query = new DBQuery(withCommand);
-		withQueries.add(query);
-		query.setWithName("with" + withQueries.size());
-		return query;
-	}
-	
-	public List<DBQuery> getWithQueries() {
-		return withQueries;
-	}
+
 }
\ No newline at end of file


> Add support of WITH clause fo oracle and postgresql
> ---------------------------------------------------
>
>                 Key: EMPIREDB-244
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-244
>             Project: Empire-DB
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Pavel Semenov
>            Priority: Minor
>
> We have implemented support of WITH clause for Oracle for our neends. It will be great
if it will be added to the empiredb core.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message