mirror of https://github.com/apache/openjpa.git
OPENJPA-2131 - Commit contribution by Zilin Chen.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1309495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8e445e03a1
commit
06742412b3
|
@ -362,10 +362,12 @@ public class OracleDictionary
|
||||||
for (Iterator itr = aliases.iterator(); itr.hasNext(); i++) {
|
for (Iterator itr = aliases.iterator(); itr.hasNext(); i++) {
|
||||||
alias = itr.next();
|
alias = itr.next();
|
||||||
String asString = null;
|
String asString = null;
|
||||||
if (alias instanceof SQLBuffer)
|
if (alias instanceof SQLBuffer) {
|
||||||
asString = ((SQLBuffer) alias).getSQL();
|
asString = ((SQLBuffer) alias).getSQL();
|
||||||
else
|
selectSQL.appendParamOnly((SQLBuffer) alias);
|
||||||
|
} else {
|
||||||
asString = alias.toString();
|
asString = alias.toString();
|
||||||
|
}
|
||||||
selectSQL.append(asString);
|
selectSQL.append(asString);
|
||||||
if (asString.indexOf(" AS ") == -1)
|
if (asString.indexOf(" AS ") == -1)
|
||||||
selectSQL.append(" AS c").append(String.valueOf(i));
|
selectSQL.append(" AS c").append(String.valueOf(i));
|
||||||
|
|
|
@ -102,16 +102,23 @@ public final class SQLBuffer
|
||||||
* Append all SQL and parameters of the given buffer.
|
* Append all SQL and parameters of the given buffer.
|
||||||
*/
|
*/
|
||||||
public SQLBuffer append(SQLBuffer buf) {
|
public SQLBuffer append(SQLBuffer buf) {
|
||||||
append(buf, _sql.length(), (_params == null) ? 0 : _params.size(),
|
append(buf, _sql.length(), (_params == null) ? 0 : _params.size(), true, false);
|
||||||
true);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append all SQL and parameters of the given buffer at the given positions.
|
* Append parameters only if the given buffer at the given positions.
|
||||||
|
*/
|
||||||
|
public SQLBuffer appendParamOnly(SQLBuffer buf) {
|
||||||
|
append(buf, _sql.length(), (_params == null) ? 0 : _params.size(), true, true);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append parameters and/or SQL of the given buffer at the given positions.
|
||||||
*/
|
*/
|
||||||
private void append(SQLBuffer buf, int sqlIndex, int paramIndex,
|
private void append(SQLBuffer buf, int sqlIndex, int paramIndex,
|
||||||
boolean subsels) {
|
boolean subsels, boolean paramOnly) {
|
||||||
if (subsels) {
|
if (subsels) {
|
||||||
// only allow appending of buffers with subselects, not insertion
|
// only allow appending of buffers with subselects, not insertion
|
||||||
if (_subsels != null && !_subsels.isEmpty()
|
if (_subsels != null && !_subsels.isEmpty()
|
||||||
|
@ -128,10 +135,12 @@ public final class SQLBuffer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sqlIndex == _sql.length())
|
if (!paramOnly) {
|
||||||
_sql.append(buf._sql.toString());
|
if (sqlIndex == _sql.length())
|
||||||
else
|
_sql.append(buf._sql.toString());
|
||||||
_sql.insert(sqlIndex, buf._sql.toString());
|
else
|
||||||
|
_sql.insert(sqlIndex, buf._sql.toString());
|
||||||
|
}
|
||||||
|
|
||||||
if (buf._params != null) {
|
if (buf._params != null) {
|
||||||
if (_params == null)
|
if (_params == null)
|
||||||
|
@ -404,7 +413,7 @@ public final class SQLBuffer
|
||||||
else
|
else
|
||||||
buf = sub.select.toSelect(false, sub.fetch);
|
buf = sub.select.toSelect(false, sub.fetch);
|
||||||
buf.resolveSubselects();
|
buf.resolveSubselects();
|
||||||
append(buf, sub.sqlIndex, sub.paramIndex, false);
|
append(buf, sub.sqlIndex, sub.paramIndex, false, false);
|
||||||
}
|
}
|
||||||
_subsels.clear();
|
_subsels.clear();
|
||||||
}
|
}
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -522,12 +522,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
<artifactId>jaxb-impl</artifactId>
|
<artifactId>jaxb-impl</artifactId>
|
||||||
<version>2.0.5</version>
|
<version>2.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>hsqldb</groupId>
|
<groupId>hsqldb</groupId>
|
||||||
|
|
Loading…
Reference in New Issue