mirror of https://github.com/apache/openjpa.git
OPENJPA-240 Feature:Persistent field mapping support for XML column type.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@547831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d384dcb8fd
commit
f026af58cd
|
@ -207,6 +207,8 @@ public class DB2Dictionary
|
|||
supportsLockingWithInnerJoin = true;
|
||||
supportsLockingWithOuterJoin = true;
|
||||
forUpdateClause = "WITH RR USE AND KEEP UPDATE LOCKS";
|
||||
if (maj >=9)
|
||||
supportsXMLColumn = true;
|
||||
}
|
||||
|
||||
if (metaData.getDatabaseProductVersion().indexOf("DSN") != -1) {
|
||||
|
|
|
@ -212,6 +212,7 @@ public class DBDictionary
|
|||
public boolean requiresCastForMathFunctions = false;
|
||||
public boolean requiresCastForComparisons = false;
|
||||
public boolean supportsModOperator = false;
|
||||
public boolean supportsXMLColumn = false;
|
||||
|
||||
// functions
|
||||
public String castFunction = "CAST({0} AS {1})";
|
||||
|
@ -273,6 +274,8 @@ public class DBDictionary
|
|||
public String tinyintTypeName = "TINYINT";
|
||||
public String varbinaryTypeName = "VARBINARY";
|
||||
public String varcharTypeName = "VARCHAR";
|
||||
public String xmlTypeName = "XML";
|
||||
public String getStringVal = "";
|
||||
|
||||
// schema metadata
|
||||
public boolean useSchemaName = true;
|
||||
|
|
|
@ -130,6 +130,8 @@ public class OracleDictionary
|
|||
"CTXSYS", "MDSYS", "SYS", "SYSTEM", "WKSYS", "WMSYS", "XDB",
|
||||
}));
|
||||
|
||||
supportsXMLColumn = true;
|
||||
xmlTypeName = "XMLType";
|
||||
bigintTypeName = "NUMBER{0}";
|
||||
bitTypeName = "NUMBER{0}";
|
||||
decimalTypeName = "NUMBER{0}";
|
||||
|
@ -182,15 +184,23 @@ public class OracleDictionary
|
|||
driverVendor = VENDOR_ORACLE + meta.getDriverMajorVersion()
|
||||
+ meta.getDriverMinorVersion();
|
||||
|
||||
String productVersion = meta.getDatabaseProductVersion()
|
||||
.split("Release ",0)[1].split("\\.",0)[0];
|
||||
int release = Integer.parseInt(productVersion);
|
||||
|
||||
// warn sql92
|
||||
if (meta.getDatabaseProductVersion().indexOf("Release 8.") > 0)
|
||||
{
|
||||
if (release == 8) {
|
||||
if (joinSyntax == SYNTAX_SQL92 && log.isWarnEnabled())
|
||||
log.warn(_loc.get("oracle-syntax"));
|
||||
joinSyntax = SYNTAX_DATABASE;
|
||||
dateTypeName = "DATE"; // added oracle 9
|
||||
timestampTypeName = "DATE"; // added oracle 9
|
||||
supportsXMLColumn = false;
|
||||
}
|
||||
else
|
||||
// select of an xml column requires ".getStringVal()"
|
||||
// suffix. eg. t0.xmlcol.getStringVal()
|
||||
getStringVal = ".getStringVal()";
|
||||
} else if (metadataClassName.startsWith("com.ddtek.")
|
||||
|| url.indexOf("jdbc:datadirect:oracle:") != -1
|
||||
|| "Oracle".equals(driverName)) {
|
||||
|
@ -499,7 +509,8 @@ public class OracleDictionary
|
|||
throws SQLException {
|
||||
if (colType == Types.BLOB && _driverBehavior == BEHAVE_ORACLE)
|
||||
stmnt.setBlob(idx, getEmptyBlob());
|
||||
else if (colType == Types.CLOB && _driverBehavior == BEHAVE_ORACLE)
|
||||
else if (colType == Types.CLOB && _driverBehavior == BEHAVE_ORACLE
|
||||
&& !col.isXML())
|
||||
stmnt.setClob(idx, getEmptyClob());
|
||||
else if ((colType == Types.STRUCT || colType == Types.OTHER)
|
||||
&& col != null && col.getTypeName() != null)
|
||||
|
@ -509,7 +520,7 @@ public class OracleDictionary
|
|||
else if (colType == Types.DATE)
|
||||
super.setNull(stmnt, idx, Types.TIMESTAMP, col);
|
||||
// the Oracle driver does not support Types.OTHER with setNull
|
||||
else if (colType == Types.OTHER)
|
||||
else if (colType == Types.OTHER || col.isXML())
|
||||
super.setNull(stmnt, idx, Types.NULL, col);
|
||||
else
|
||||
super.setNull(stmnt, idx, colType, col);
|
||||
|
|
|
@ -79,6 +79,9 @@ public class SQLServerDictionary
|
|||
driverVendor = VENDOR_OTHER;
|
||||
} else
|
||||
driverVendor = VENDOR_OTHER;
|
||||
if (driverName.contains(platform) && Integer.parseInt(driverName
|
||||
.split("Server ",0)[1].split(" ")[0]) >= 2005)
|
||||
supportsXMLColumn = true;
|
||||
}
|
||||
|
||||
// warn about using cursors
|
||||
|
|
|
@ -189,6 +189,7 @@ public class SelectImpl
|
|||
_conf = conf;
|
||||
_dict = _conf.getDBDictionaryInstance();
|
||||
_joinSyntax = _dict.joinSyntax;
|
||||
_selects._dict = _dict;
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
|
@ -2661,6 +2662,7 @@ public class SelectImpl
|
|||
private List _idents = null;
|
||||
private Map _aliases = null;
|
||||
private Map _selectAs = null;
|
||||
private DBDictionary _dict = null;
|
||||
|
||||
/**
|
||||
* Add all aliases from another instance.
|
||||
|
@ -2769,6 +2771,9 @@ public class SelectImpl
|
|||
Object id = (ident && _idents != null) ? _idents.get(i)
|
||||
: _ids.get(i);
|
||||
Object alias = _aliases.get(id);
|
||||
if (id instanceof Column && ((Column)id).isXML())
|
||||
alias = alias + _dict.getStringVal;
|
||||
|
||||
String as = null;
|
||||
if (inner)
|
||||
as = ((String) alias).replace('.', '_');
|
||||
|
|
Loading…
Reference in New Issue