mirror of https://github.com/apache/openjpa.git
fix formatting and readability
This commit is contained in:
parent
87422c8323
commit
1690076b37
|
@ -60,6 +60,15 @@ public class SQLServerDictionary extends AbstractSQLServerDictionary {
|
|||
*/
|
||||
public boolean uniqueIdentifierAsVarbinary = true;
|
||||
|
||||
/**
|
||||
* Whether to send Time values as DateTime or as Time.
|
||||
* This affects how the Database actually looks like.
|
||||
* sendTimeAsDatetime is supported as of SQLServer2008 and
|
||||
* is only to be used with TIME columns.
|
||||
* Previous to that a DATETIME column had to be used with a fixed 1970-01-01 date.
|
||||
*/
|
||||
public Boolean sendTimeAsDatetime = null;
|
||||
|
||||
public SQLServerDictionary() {
|
||||
platform = "Microsoft SQL Server";
|
||||
// SQLServer locks on a table-by-table basis
|
||||
|
@ -69,10 +78,8 @@ public class SQLServerDictionary extends AbstractSQLServerDictionary {
|
|||
requiresAliasForSubselect = true;
|
||||
stringLengthFunction = "LEN({0})";
|
||||
|
||||
timeTypeName = "TIME";
|
||||
timeWithZoneTypeName = "TIME";
|
||||
timestampWithZoneTypeName = "DATETIMEOFFSET";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,13 +91,17 @@ public class SQLServerDictionary extends AbstractSQLServerDictionary {
|
|||
String url = meta.getURL();
|
||||
if (driverVendor == null) {
|
||||
// serverMajorVersion of 8==2000, 9==2005, 10==2008, 11==2012
|
||||
if (meta.getDatabaseMajorVersion() >= 9)
|
||||
if (meta.getDatabaseMajorVersion() >= 9) {
|
||||
setSupportsXMLColumn(true);
|
||||
if (sendTimeAsDatetime == null) {
|
||||
sendTimeAsDatetime = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
if (meta.getDatabaseMajorVersion() >= 10) {
|
||||
// MSSQL 2008 supports new date, time and datetime2 types
|
||||
// Use DATETIME2 which has 100ns vs. 3.333msec precision
|
||||
dateTypeName = "DATETIME2";
|
||||
timeTypeName = "DATETIME2";
|
||||
dateTypeName = "DATE";
|
||||
timeTypeName = "TIME";
|
||||
timestampTypeName = "DATETIME2";
|
||||
datePrecision = MICRO / 10;
|
||||
}
|
||||
|
@ -402,7 +413,7 @@ public class SQLServerDictionary extends AbstractSQLServerDictionary {
|
|||
if (start != null) {
|
||||
buf.append(", ");
|
||||
start.appendTo(buf);
|
||||
p }
|
||||
}
|
||||
buf.append(")");
|
||||
}
|
||||
|
||||
|
|
|
@ -246,13 +246,14 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
|
||||
@Override
|
||||
public CriteriaQuery<T> groupBy(Expression<?>... grouping) {
|
||||
if (grouping == null) {
|
||||
_groups = null;
|
||||
return this;
|
||||
}
|
||||
if (grouping == null) {
|
||||
_groups = null;
|
||||
return this;
|
||||
}
|
||||
_groups = new ArrayList<>();
|
||||
for (Expression<?> e : grouping)
|
||||
_groups.add(e);
|
||||
for (Expression<?> e : grouping) {
|
||||
_groups.add(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -284,8 +285,9 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
return this;
|
||||
}
|
||||
_having = new PredicateImpl.And();
|
||||
for (Predicate p : restrictions)
|
||||
_having.add(p);
|
||||
for (Predicate p : restrictions) {
|
||||
_having.add(p);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -718,8 +720,9 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
}
|
||||
|
||||
private void renderList(StringBuilder buffer, String clause, Collection<?> coll) {
|
||||
if (coll == null || coll.isEmpty())
|
||||
if (coll == null || coll.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.append(clause);
|
||||
for (Iterator<?> i = coll.iterator(); i.hasNext(); ) {
|
||||
|
@ -729,7 +732,10 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
}
|
||||
|
||||
private void renderJoins(StringBuilder buffer, Collection<Join<?,?>> joins) {
|
||||
if (joins == null) return;
|
||||
if (joins == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Join j : joins) {
|
||||
buffer.append(((CriteriaExpression)j).asVariable(this)).append(" ");
|
||||
renderJoins(buffer, j.getJoins());
|
||||
|
@ -738,7 +744,9 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
}
|
||||
|
||||
private void renderRoots(StringBuilder buffer, Collection<Root<?>> roots) {
|
||||
if (roots == null) return;
|
||||
if (roots == null) {
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
for (Root r : roots) {
|
||||
buffer.append(((ExpressionImpl<?>)r).asVariable(this));
|
||||
|
@ -748,7 +756,9 @@ class CriteriaQueryImpl<T> implements OpenJPACriteriaQuery<T>, AliasContext {
|
|||
}
|
||||
}
|
||||
private void renderFetches(StringBuilder buffer, Set<Fetch> fetches) {
|
||||
if (fetches == null) return;
|
||||
if (fetches == null) {
|
||||
return;
|
||||
}
|
||||
for (Fetch j : fetches) {
|
||||
buffer.append(((ExpressionImpl<?>)j).asValue(this)).append(" ");
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -80,7 +80,7 @@
|
|||
<mysql.connector.version>5.1.47</mysql.connector.version>
|
||||
<mariadb.connector.version>2.2.0</mariadb.connector.version>
|
||||
<postgresql.connector.version>42.2.5</postgresql.connector.version>
|
||||
<mssql.connector.version>7.2.0.jre8</mssql.connector.version>
|
||||
<mssql.connector.version>7.2.1</mssql.connector.version>
|
||||
|
||||
<!-- other common versions -->
|
||||
<slf4j.version>1.7.23</slf4j.version>
|
||||
|
|
Loading…
Reference in New Issue