mirror of https://github.com/apache/openjpa.git
Undo OPENJPA_356 in 1.0.x branch
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@577522 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
972e71f970
commit
bd40a0cea5
|
@ -155,33 +155,6 @@ public class DB2Dictionary
|
|||
append(" ROWS ONLY");
|
||||
}
|
||||
|
||||
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel,
|
||||
int idx) {
|
||||
// if this is a literal value, add a cast...
|
||||
Object val = sel.getSelects().get(idx);
|
||||
if (val instanceof Lit)
|
||||
selectSQL.append("CAST(");
|
||||
|
||||
// ... and add the select per super's behavior...
|
||||
super.appendSelect(selectSQL, alias, sel, idx);
|
||||
|
||||
// ... and finish the cast
|
||||
if (val instanceof Lit) {
|
||||
Class c = ((Lit) val).getType();
|
||||
int javaTypeCode = JavaTypes.getTypeCode(c);
|
||||
int jdbcTypeCode = getJDBCType(javaTypeCode, false);
|
||||
String typeName = getTypeName(jdbcTypeCode);
|
||||
selectSQL.append(" AS " + typeName);
|
||||
|
||||
// if the literal is a string, use the default char col size
|
||||
// in the cast statement.
|
||||
if (String.class.equals(c))
|
||||
selectSQL.append("(" + characterColumnSize + ")");
|
||||
|
||||
selectSQL.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getCreateSequenceSQL(Sequence seq) {
|
||||
String[] sql = super.getCreateSequenceSQL(seq);
|
||||
if (seq.getAllocate() > 1)
|
||||
|
@ -673,8 +646,6 @@ public class DB2Dictionary
|
|||
String fstring = null;
|
||||
String type = getTypeName(getJDBCType(JavaTypes.getTypeCode(val
|
||||
.getType()), false));
|
||||
if (String.class.equals(val.getType()))
|
||||
type = type + "(" + characterColumnSize + ")";
|
||||
fstring = "CAST(? AS " + type + ")";
|
||||
return fstring;
|
||||
}
|
||||
|
@ -759,10 +730,7 @@ public class DB2Dictionary
|
|||
String sqlString = buf.getSQL(false);
|
||||
if (sqlString.endsWith("?")) {
|
||||
// case "(?" - convert to "CAST(? AS type"
|
||||
String typeName = getTypeName(type);
|
||||
if (String.class.equals(val.getType()))
|
||||
typeName = typeName + "(" + characterColumnSize + ")";
|
||||
String str = "CAST(? AS " + typeName + ")";
|
||||
String str = "CAST(? AS " + getTypeName(type) + ")";
|
||||
buf.replaceSqlString(sqlString.length() - 1,
|
||||
sqlString.length(), str);
|
||||
}
|
||||
|
|
|
@ -2281,30 +2281,18 @@ public class DBDictionary
|
|||
aliases = sel.getSelectAliases();
|
||||
|
||||
Object alias;
|
||||
for (int i = 0; i < aliases.size(); i++) {
|
||||
alias = aliases.get(i);
|
||||
appendSelect(selectSQL, alias, sel, i);
|
||||
if (i < aliases.size() - 1)
|
||||
for (Iterator itr = aliases.iterator(); itr.hasNext();) {
|
||||
alias = itr.next();
|
||||
if (alias instanceof SQLBuffer)
|
||||
selectSQL.append((SQLBuffer) alias);
|
||||
else
|
||||
selectSQL.append(alias.toString());
|
||||
if (itr.hasNext())
|
||||
selectSQL.append(", ");
|
||||
}
|
||||
return selectSQL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append <code>elem</code> to <code>selectSQL</code>.
|
||||
* @param selectSQL The SQLBuffer to append to.
|
||||
* @param alias A {@link SQLBuffer} or a {@link String} to append.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
protected void appendSelect(SQLBuffer selectSQL, Object elem, Select sel,
|
||||
int idx) {
|
||||
if (elem instanceof SQLBuffer)
|
||||
selectSQL.append((SQLBuffer) elem);
|
||||
else
|
||||
selectSQL.append(elem.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a "FOR UPDATE" clause can be used for the specified
|
||||
* Select object.
|
||||
|
|
|
@ -447,10 +447,6 @@ public class LogicalUnion
|
|||
return sel.getTableAliases();
|
||||
}
|
||||
|
||||
public List getSelects() {
|
||||
return sel.getSelects();
|
||||
}
|
||||
|
||||
public List getSelectAliases() {
|
||||
return sel.getSelectAliases();
|
||||
}
|
||||
|
|
|
@ -149,14 +149,6 @@ public interface Select
|
|||
*/
|
||||
public Collection getTableAliases();
|
||||
|
||||
/**
|
||||
* Return the actual {@link Val}s and {@link Column}s that were
|
||||
* selected, in the order that they were selected.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public List getSelects();
|
||||
|
||||
/**
|
||||
* Return the aliases of all selected columns and all selected buffers,
|
||||
* in the order they were selected. Each alias may be either a string
|
||||
|
|
|
@ -505,10 +505,6 @@ public class SelectImpl
|
|||
return (_tables == null) ? Collections.EMPTY_SET : _tables.values();
|
||||
}
|
||||
|
||||
public List getSelects() {
|
||||
return Collections.unmodifiableList(_selects);
|
||||
}
|
||||
|
||||
public List getSelectAliases() {
|
||||
return _selects.getAliases(false, _outer != null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue