提交 679b07b0 authored 作者: Thomas Mueller's avatar Thomas Mueller

boolean getX > isX

上级 9cbd604d
......@@ -127,7 +127,7 @@ public class Optimizer {
double costPart = -1.0;
int bestPart = -1;
for (int j = 0; j < filters.length; j++) {
if (!filters[j].getUsed()) {
if (!filters[j].isUsed()) {
if (i == filters.length - 1) {
bestPart = j;
break;
......
......@@ -239,7 +239,7 @@ public class Select extends Query {
ObjectArray<Index> indexes = topTableFilter.getTable().getIndexes();
for (int i = 0; indexes != null && i < indexes.size(); i++) {
Index index = indexes.get(i);
if (index.getIndexType().getScan()) {
if (index.getIndexType().isScan()) {
continue;
}
if (isGroupSortedIndex(topTableFilter, index)) {
......@@ -414,7 +414,7 @@ public class Select extends Query {
// can't use the scan index
continue;
}
if (index.getIndexType().getHash()) {
if (index.getIndexType().isHash()) {
continue;
}
IndexColumn[] indexCols = index.getIndexColumns();
......@@ -748,10 +748,10 @@ public class Select extends Query {
boolean ascending = columnIndex.getIndexColumns()[0].sortType == SortOrder.ASCENDING;
Index current = topTableFilter.getIndex();
// if another index is faster
if (columnIndex.canFindNext() && ascending && (current == null || current.getIndexType().getScan() || columnIndex == current)) {
if (columnIndex.canFindNext() && ascending && (current == null || current.getIndexType().isScan() || columnIndex == current)) {
IndexType type = columnIndex.getIndexType();
// hash indexes don't work, and unique single column indexes don't work
if (!type.getHash() && (!type.getUnique() || columnIndex.getColumns().length > 1)) {
if (!type.isHash() && (!type.isUnique() || columnIndex.getColumns().length > 1)) {
topTableFilter.setIndex(columnIndex);
isDistinctQuery = true;
}
......@@ -762,7 +762,7 @@ public class Select extends Query {
if (sort != null && !isQuickAggregateQuery && !isGroupQuery) {
Index index = getSortIndex();
Index current = topTableFilter.getIndex();
if (index != null && (current.getIndexType().getScan() || current == index)) {
if (index != null && (current.getIndexType().isScan() || current == index)) {
topTableFilter.setIndex(index);
if (!distinct || isDistinctQuery) {
// sort using index would not work correctly for distinct result sets
......@@ -774,7 +774,7 @@ public class Select extends Query {
if (SysProperties.OPTIMIZE_GROUP_SORTED && !isQuickAggregateQuery && isGroupQuery && getGroupByExpressionCount() > 0) {
Index index = getGroupSortedIndex();
Index current = topTableFilter.getIndex();
if (index != null && (current.getIndexType().getScan() || current == index)) {
if (index != null && (current.getIndexType().isScan() || current == index)) {
topTableFilter.setIndex(index);
isGroupSortedQuery = true;
}
......
......@@ -52,7 +52,7 @@ public abstract class Constraint extends SchemaObjectBase implements Comparable<
public Constraint(Schema schema, int id, String name, Table table) {
initSchemaObjectBase(schema, id, name, Trace.CONSTRAINT);
this.table = table;
this.setTemporary(table.getTemporary());
this.setTemporary(table.isTemporary());
}
/**
......
......@@ -207,7 +207,7 @@ public class ConstraintReferential extends Constraint {
public void setRefTable(Table refTable) {
this.refTable = refTable;
if (refTable.getTemporary()) {
if (refTable.isTemporary()) {
setTemporary(true);
}
}
......
......@@ -637,7 +637,7 @@ public class Database implements DataHandler {
if (pageStore != null) {
headPos = pageStore.getSystemTableHeadPos();
}
meta = mainSchema.createTable("SYS", 0, cols, persistent, persistent, false, headPos, systemSession);
meta = mainSchema.createTable("SYS", 0, cols, false, persistent, persistent, false, headPos, systemSession);
IndexColumn[] pkCols = IndexColumn.wrap(new Column[] { columnId });
metaIdIndex = meta.addIndex(systemSession, "SYS_ID", 0, pkCols, IndexType.createPrimaryKey(
false, false), Index.EMPTY_HEAD, null);
......@@ -709,13 +709,13 @@ public class Database implements DataHandler {
for (Table obj : getAllTablesAndViews()) {
if (obj instanceof TableView) {
TableView view = (TableView) obj;
if (view.getInvalid()) {
if (view.isInvalid()) {
try {
view.recompile(session);
} catch (SQLException e) {
// ignore
}
if (!view.getInvalid()) {
if (!view.isInvalid()) {
recompileSuccessful = true;
}
}
......@@ -728,7 +728,7 @@ public class Database implements DataHandler {
for (Table obj : getAllTablesAndViews()) {
if (obj instanceof TableView) {
TableView view = (TableView) obj;
if (!view.getInvalid()) {
if (!view.isInvalid()) {
try {
view.recompile(systemSession);
} catch (SQLException e) {
......@@ -810,7 +810,7 @@ public class Database implements DataHandler {
private synchronized void addMeta(Session session, DbObject obj) throws SQLException {
int id = obj.getId();
if (id > 0 && !starting && !obj.getTemporary()) {
if (id > 0 && !starting && !obj.isTemporary()) {
Row r = meta.getTemplateRow();
MetaRecord rec = new MetaRecord(obj);
rec.setRecord(r);
......@@ -918,7 +918,7 @@ public class Database implements DataHandler {
HashMap<String, DbObject> map = getMap(obj.getType());
if (obj.getType() == DbObject.USER) {
User user = (User) obj;
if (user.getAdmin() && systemUser.getName().equals(Constants.DBA_NAME)) {
if (user.isAdmin() && systemUser.getName().equals(Constants.DBA_NAME)) {
systemUser.rename(user.getName());
}
}
......@@ -1304,7 +1304,6 @@ public class Database implements DataHandler {
if ((i & 1) != (dataFile ? 1 : 0)) {
i++;
}
while (storageMap.get(i) != null || objectIds.get(i)) {
i++;
if ((i & 1) != (dataFile ? 1 : 0)) {
......@@ -1677,21 +1676,21 @@ public class Database implements DataHandler {
int type = obj.getType();
if (type == DbObject.TABLE_OR_VIEW) {
Table table = (Table) obj;
if (table.getTemporary() && !table.getGlobalTemporary()) {
if (table.isTemporary() && !table.isGlobalTemporary()) {
session.removeLocalTempTable(table);
return;
}
} else if (type == DbObject.INDEX) {
Index index = (Index) obj;
Table table = index.getTable();
if (table.getTemporary() && !table.getGlobalTemporary()) {
if (table.isTemporary() && !table.isGlobalTemporary()) {
session.removeLocalTempTableIndex(index);
return;
}
} else if (type == DbObject.CONSTRAINT) {
Constraint constraint = (Constraint) obj;
Table table = constraint.getTable();
if (table.getTemporary() && !table.getGlobalTemporary()) {
if (table.isTemporary() && !table.isGlobalTemporary()) {
session.removeLocalTempTableConstraint(constraint);
return;
}
......
......@@ -196,7 +196,7 @@ public interface DbObject {
*
* @return true if is temporary
*/
boolean getTemporary();
boolean isTemporary();
/**
* Tell this object that it is temporary or not.
......
......@@ -155,7 +155,7 @@ public abstract class DbObjectBase implements DbObject {
setModified();
}
public boolean getTemporary() {
public boolean isTemporary() {
return temporary;
}
......
......@@ -83,7 +83,7 @@ public class Engine {
}
}
}
if (opened && (user == null || !user.getAdmin())) {
if (opened && (user == null || !user.isAdmin())) {
// reset - because the user is not an admin, and has no
// right to listen to exceptions
database.setEventListener(null);
......
......@@ -1008,7 +1008,7 @@ public class Session extends SessionWithState {
this.undoLogEnabled = b;
}
public boolean getUndoLogEnabled() {
public boolean isUndoLogEnabled() {
return undoLogEnabled;
}
......@@ -1053,7 +1053,7 @@ public class Session extends SessionWithState {
/**
* Remember the result set and close it as soon as the transaction is
* committed (if it needs to be closed). This is done to delete temporary
* files as soon as possible.
* files as soon as possible, and free object ids of temporary tables.
*
* @param result the temporary result set
*/
......
......@@ -41,7 +41,7 @@ public class User extends RightOwner {
this.admin = admin;
}
public boolean getAdmin() {
public boolean isAdmin() {
return admin;
}
......@@ -117,7 +117,7 @@ public class User extends RightOwner {
return;
}
if (!isRightGrantedRecursive(table, rightMask)) {
if (table.getTemporary() && !table.getGlobalTemporary()) {
if (table.isTemporary() && !table.isGlobalTemporary()) {
// the owner has all rights on local temporary tables
return;
}
......
......@@ -114,7 +114,7 @@ public class ConditionIn extends Condition {
if (areAllValues(independent)) {
if (left instanceof ExpressionColumn) {
Column column = ((ExpressionColumn) left).getColumn();
boolean nullable = column.getNullable();
boolean nullable = column.isNullable();
CompareMode mode = session.getDatabase().getCompareMode();
for (int i = 0; i < values.size(); i++) {
Expression e = values.get(i);
......
......@@ -229,7 +229,7 @@ public class ExpressionColumn extends Expression {
}
public int getNullable() {
return column.getNullable() ? Column.NULLABLE : Column.NOT_NULLABLE;
return column.isNullable() ? Column.NULLABLE : Column.NOT_NULLABLE;
}
public boolean isEverything(ExpressionVisitor visitor) {
......
......@@ -204,7 +204,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
int index = column.getColumnId();
int mask = masks[index];
if ((mask & IndexCondition.EQUALITY) == IndexCondition.EQUALITY) {
if (i == columns.length - 1 && getIndexType().getUnique()) {
if (i == columns.length - 1 && getIndexType().isUnique()) {
cost = getLookupCost(rowCount) + 1;
break;
}
......@@ -319,7 +319,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
public String getCreateSQLForCopy(Table table, String quotedName) {
StringBuilder buff = new StringBuilder("CREATE ");
buff.append(indexType.getSQL());
if (!indexType.getPrimaryKey()) {
if (!indexType.isPrimaryKey()) {
buff.append(' ').append(quotedName);
}
buff.append(" ON ").append(table.getSQL());
......
......@@ -60,7 +60,7 @@ public class BtreeLeaf extends BtreePage {
SearchRow row = pageData.get(i);
int comp = index.compareRows(row, newRow);
if (comp == 0) {
if (index.indexType.getUnique()) {
if (index.indexType.isUnique()) {
if (!index.containsNullAndAllowMultipleNull(newRow)) {
throw index.getDuplicateKeyException();
}
......
......@@ -78,7 +78,7 @@ public class BtreeNode extends BtreePage {
SearchRow row = getData(i);
int comp = index.compareRows(row, newRow);
if (comp == 0) {
if (index.indexType.getUnique()) {
if (index.indexType.isUnique()) {
if (!index.containsNullAndAllowMultipleNull(newRow)) {
throw index.getDuplicateKeyException();
}
......@@ -187,7 +187,7 @@ public class BtreeNode extends BtreePage {
IntArray children = new IntArray();
splitPoint++;
int max = pageData.size();
if (SysProperties.CHECK && index.getDatabase().getLogIndexChanges() && !getDeleted()) {
if (SysProperties.CHECK && index.getDatabase().getLogIndexChanges() && !isDeleted()) {
// page must have been deleted already before calling
// getSplitPoint()
Message.throwInternalError();
......
......@@ -93,7 +93,7 @@ public class IndexType {
*
* @return true if it is a hash index
*/
public boolean getHash() {
public boolean isHash() {
return hash;
}
......@@ -102,7 +102,7 @@ public class IndexType {
*
* @return true if it is persistent
*/
public boolean getPersistent() {
public boolean isPersistent() {
return persistent;
}
......@@ -111,7 +111,7 @@ public class IndexType {
*
* @return true if it references a primary key constraint
*/
public boolean getPrimaryKey() {
public boolean isPrimaryKey() {
return primaryKey;
}
......@@ -120,7 +120,7 @@ public class IndexType {
*
* @return true if it is
*/
public boolean getUnique() {
public boolean isUnique() {
return unique;
}
......@@ -153,7 +153,7 @@ public class IndexType {
*
* @return true if it is
*/
public boolean getScan() {
public boolean isScan() {
return scan;
}
......
......@@ -125,7 +125,7 @@ public class MultiVersionCursor implements Cursor {
}
int sessionId = deltaRow.getSessionId();
boolean isThisSession = sessionId == session.getId();
boolean isDeleted = deltaRow.getDeleted();
boolean isDeleted = deltaRow.isDeleted();
if (isThisSession && isDeleted) {
needNewDelta = true;
continue;
......
......@@ -289,8 +289,8 @@ public class MultiVersionIndex implements Index {
return base.getName();
}
public boolean getTemporary() {
return base.getTemporary();
public boolean isTemporary() {
return base.isTemporary();
}
public void rename(String newName) throws SQLException {
......
......@@ -55,7 +55,7 @@ public class ScanCursor implements Cursor {
continue;
}
row = delta.next();
if (!row.getDeleted() || row.getSessionId() == session.getId()) {
if (!row.isDeleted() || row.getSessionId() == session.getId()) {
continue;
}
} else {
......
......@@ -50,7 +50,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
sessionRowCount = New.hashMap();
}
tableData = table;
if (!database.isPersistent() || id < 0 || !indexType.getPersistent()) {
if (!database.isPersistent() || id < 0 || !indexType.isPersistent()) {
return;
}
this.storage = database.getStorage(table, id, true);
......
......@@ -53,7 +53,7 @@ public class TreeIndex extends BaseIndex {
Row r = n.row;
int compare = compareRows(row, r);
if (compare == 0) {
if (indexType.getUnique()) {
if (indexType.isUnique()) {
if (!containsNullAndAllowMultipleNull(row)) {
throw getDuplicateKeyException();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论