提交 dc3d3fd7 authored 作者: Jacek Ławrynowicz's avatar Jacek Ławrynowicz

if inlining improvements, other review changes

上级 4f750584
......@@ -140,7 +140,10 @@ public class TimestampWithTimeZone implements Serializable, Cloneable {
if (timeNanos != other.timeNanos) {
return false;
}
return timeZoneOffsetMins == other.timeZoneOffsetMins;
if (timeZoneOffsetMins != other.timeZoneOffsetMins) {
return false;
}
return true;
}
}
......@@ -71,8 +71,10 @@ public class DbSchema {
} else if (contents.isPostgreSQL() &&
StringUtils.toUpperEnglish(name).startsWith("PG_")) {
isSystem = true;
} else if (contents.isDerby() && name.startsWith("SYS")) {
isSystem = true;
} else {
isSystem = contents.isDerby() && name.startsWith("SYS");
isSystem = false;
}
}
......
......@@ -285,11 +285,6 @@ public class Parser {
if (hasMore) {
String remaining = originalSQL.substring(parseIndex);
if (remaining.trim().length() != 0) {
// list.addCommand(c);
// do {
// c = parseCommand();
// list.addCommand(c);
// } while (currentToken.equals(";"));
c = new CommandList(this, sql, c, remaining);
}
}
......@@ -3567,21 +3562,15 @@ public class Parser {
private boolean equalsToken(String a, String b) {
if (a == null) {
return b == null;
} else if (a.equals(b)) {
return true;
} else {
return !identifiersToUpper && a.equalsIgnoreCase(b);
}
} else
return a.equals(b) || !identifiersToUpper && a.equalsIgnoreCase(b);
}
private static boolean equalsTokenIgnoreCase(String a, String b) {
if (a == null) {
return b == null;
} else if (a.equals(b)) {
return true;
} else {
return a.equalsIgnoreCase(b);
}
} else
return a.equals(b) || a.equalsIgnoreCase(b);
}
private boolean isTokenInList(Collection<String> upperCaseTokenList) {
......
......@@ -307,7 +307,11 @@ public abstract class Query extends Prepared {
!isEverything(ExpressionVisitor.INDEPENDENT_VISITOR)) {
return false;
}
return db.getModificationDataId() <= lastEval || getMaxDataModificationId() <= lastEval;
if (db.getModificationDataId() > lastEval &&
getMaxDataModificationId() > lastEval) {
return false;
}
return true;
}
public final Value[] getParameterValues() {
......
......@@ -232,10 +232,7 @@ public class Select extends Query {
}
private boolean isHavingNullOrFalse(Value[] row) {
if (havingIndex >= 0) {
return !row[havingIndex].getBoolean();
}
return false;
return havingIndex >= 0 && !row[havingIndex].getBoolean();
}
private Index getGroupSortedIndex() {
......
......@@ -219,7 +219,7 @@ public class Update extends Prepared {
for (Column c : columns) {
Expression e = expressionMap.get(c);
e.mapColumns(targetTableFilter, 0);
if (sourceTableFilter != null) {
if (sourceTableFilter!=null){
e.mapColumns(sourceTableFilter, 0);
}
expressionMap.put(c, e.optimize(session));
......
......@@ -2870,10 +2870,7 @@ public class Database implements DataHandler {
* @return true if they match
*/
public boolean equalsIdentifiers(String a, String b) {
if (a.equals(b)) {
return true;
}
return !dbSettings.databaseToUpper && a.equalsIgnoreCase(b);
return a.equals(b) || (!dbSettings.databaseToUpper && a.equalsIgnoreCase(b));
}
@Override
......
......@@ -103,7 +103,8 @@ public class SessionRemote extends SessionWithState implements DataHandler {
ArrayList<String> serverList = new ArrayList<>();
for (Transfer transfer : transferList) {
serverList.add(transfer.getSocket().getInetAddress().
getHostAddress() + ":" + transfer.getSocket().getPort());
getHostAddress() + ":" +
transfer.getSocket().getPort());
}
return serverList;
}
......
......@@ -471,7 +471,8 @@ public class FullText {
addColumnData(columns, data, expr);
Object[] col = columns.toArray();
Object[] dat = data.toArray();
return new Object[][]{col, dat};
Object[][] columnData = { col, dat };
return columnData;
}
/**
......
......@@ -138,6 +138,7 @@ public class JdbcClob extends TraceObject implements NClob
if (value.getPrecision() != 0) {
throw DbException.getInvalidValueException("length", value.getPrecision());
}
final JdbcConnection c = conn; // required to avoid synthetic method creation
// PipedReader / PipedWriter are a lot slower
// than PipedInputStream / PipedOutputStream
// (Sun/Oracle Java 1.6.0_20)
......@@ -145,7 +146,7 @@ public class JdbcClob extends TraceObject implements NClob
final Task task = new Task() {
@Override
public void call() {
value = conn.createClob(IOUtils.getReader(in), -1);
value = c.createClob(IOUtils.getReader(in), -1);
}
};
PipedOutputStream out = new PipedOutputStream(in) {
......
......@@ -146,7 +146,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements
String tableType;
if (types != null && types.length > 0) {
StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN(");
for (String type : types) {
for (String ignored : types) {
buff.appendExceptFirst(", ");
buff.append('?');
}
......
......@@ -1408,7 +1408,10 @@ public final class MVStore {
}
}
Chunk r = retainChunk;
return r == null || c.version <= r.version;
if (r != null && c.version > r.version) {
return false;
}
return true;
}
private long getTimeSinceCreation() {
......@@ -2482,7 +2485,11 @@ public final class MVStore {
// the last time
boolean fileOps;
long fileOpCount = fileStore.getWriteCount() + fileStore.getReadCount();
fileOps = autoCompactLastFileOpCount != fileOpCount;
if (autoCompactLastFileOpCount != fileOpCount) {
fileOps = true;
} else {
fileOps = false;
}
// use a lower fill rate if there were any file operations
int targetFillRate = fileOps ? autoCompactFillRate / 3 : autoCompactFillRate;
compact(targetFillRate, autoCommitMemory);
......
......@@ -736,10 +736,13 @@ public class MVTable extends TableBase {
DbException de = DbException.convert(e);
if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
for (Index index : indexes) {
if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) {
if (index.getIndexType().isUnique() &&
index instanceof MultiVersionIndex) {
MultiVersionIndex mv = (MultiVersionIndex) index;
if (mv.isUncommittedFromOtherSession(session, row)) {
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName());
throw DbException.get(
ErrorCode.CONCURRENT_UPDATE_1,
index.getName());
}
}
}
......
......@@ -777,7 +777,10 @@ public class Column {
if (defaultExpression != null && !defaultExpression.isEverything(visitor)) {
return false;
}
return checkConstraint == null || checkConstraint.isEverything(visitor);
if (checkConstraint != null && !checkConstraint.isEverything(visitor)) {
return false;
}
return true;
}
public boolean isPrimaryKey() {
......@@ -830,7 +833,10 @@ public class Column {
if (isComputed || newColumn.isComputed) {
return false;
}
return onUpdateExpression == null && newColumn.onUpdateExpression == null;
if (onUpdateExpression != null || newColumn.onUpdateExpression != null) {
return false;
}
return true;
}
/**
......
......@@ -1118,8 +1118,8 @@ public final class JoinBatch {
if (joinBatches == null) {
return;
}
for (JoinBatch joinBatche : joinBatches) {
joinBatche.viewTopFutureCursor = null;
for (JoinBatch joinBatch : joinBatches) {
joinBatch.viewTopFutureCursor = null;
}
}
}
......
......@@ -714,7 +714,10 @@ public class MetaTable extends Table {
if (indexFrom != null && db.compare(v, indexFrom) < 0) {
return false;
}
return indexTo == null || db.compare(v, indexTo) <= 0;
if (indexTo != null && db.compare(v, indexTo) > 0) {
return false;
}
return true;
}
private static String replaceNullWithEmpty(String s) {
......
......@@ -143,7 +143,8 @@ public class RegularTable extends TableBase {
if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) {
MultiVersionIndex mv = (MultiVersionIndex) index;
if (mv.isUncommittedFromOtherSession(session, row)) {
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName());
throw DbException.get(
ErrorCode.CONCURRENT_UPDATE_1, index.getName());
}
}
}
......
......@@ -583,7 +583,8 @@ public abstract class Table extends SchemaObjectBase {
if (columns.size() == 1) {
constraintsToDrop.add(constraint);
} else {
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, constraint.getSQL());
throw DbException.get(
ErrorCode.COLUMN_IS_REFERENCED_1, constraint.getSQL());
}
}
}
......@@ -602,7 +603,8 @@ public abstract class Table extends SchemaObjectBase {
if (index.getColumns().length == 1) {
indexesToDrop.add(index);
} else {
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, index.getSQL());
throw DbException.get(
ErrorCode.COLUMN_IS_REFERENCED_1, index.getSQL());
}
}
}
......
......@@ -286,7 +286,11 @@ public class TableView extends Table {
return false;
}
}
return topQuery == null || topQuery.isEverything(ExpressionVisitor.QUERY_COMPARABLE_VISITOR);
if (topQuery != null &&
!topQuery.isEverything(ExpressionVisitor.QUERY_COMPARABLE_VISITOR)) {
return false;
}
return true;
}
public Query getTopQuery() {
......
......@@ -613,7 +613,8 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData,
*/
@Override
public Clob getClob(int columnIndex) throws SQLException {
return (Clob) get(columnIndex);
Clob c = (Clob) get(columnIndex);
return c == null ? null : c;
}
/**
......
......@@ -275,7 +275,10 @@ public class CompareMode {
if (strength != o.strength) {
return false;
}
return binaryUnsigned == o.binaryUnsigned;
if (binaryUnsigned != o.binaryUnsigned) {
return false;
}
return true;
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论