提交 06b6fe93 authored 作者: Thomas Mueller's avatar Thomas Mueller

remove unnecessary parameter

上级 8b2c84f7
......@@ -243,8 +243,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
return 0;
}
public boolean containsNullAndAllowMultipleNull(Session session, Row newRow) {
Mode mode = session.getDatabase().getMode();
public boolean containsNullAndAllowMultipleNull(SearchRow newRow) {
Mode mode = database.getMode();
if (mode.uniqueIndexSingleNull) {
return false;
} else if (mode.uniqueIndexSingleNullExceptAllColumnsAreNull) {
......
......@@ -191,7 +191,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
lastChange = 0;
if (storage != null) {
storage.getDiskFile().flush();
if (!database.getReadOnly()) {
if (!database.isReadOnly()) {
deletePage(session, head);
// if we log index changes now, then the index is consistent
// if we don't log index changes, then the index is only consistent
......@@ -348,7 +348,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
private void flushHead(Session session) throws SQLException {
updatePage(session, head);
if (!database.getLogIndexChanges() && !database.getReadOnly()) {
if (!database.getLogIndexChanges() && !database.isReadOnly()) {
storage.flushRecord(head);
}
if (trace.isDebugEnabled()) {
......
......@@ -63,7 +63,7 @@ public class BtreeLeaf extends BtreePage {
int comp = index.compareRows(row, newRow);
if (comp == 0) {
if (index.indexType.getUnique()) {
if (!index.containsNullAndAllowMultipleNull(session, newRow)) {
if (!index.containsNullAndAllowMultipleNull(newRow)) {
throw index.getDuplicateKeyException();
}
}
......
......@@ -83,7 +83,7 @@ public class BtreeNode extends BtreePage {
int comp = index.compareRows(row, newRow);
if (comp == 0) {
if (index.indexType.getUnique()) {
if (!index.containsNullAndAllowMultipleNull(session, newRow)) {
if (!index.containsNullAndAllowMultipleNull(newRow)) {
throw index.getDuplicateKeyException();
}
}
......
......@@ -190,12 +190,11 @@ public interface Index extends SchemaObject {
* allowed using the current compatibility mode for unique indexes. Note:
* NULL behavior is complicated in SQL.
*
* @param session the session
* @param newRow the row to check
* @return true if one of the columns is null and multiple nulls in unique
* indexes are allowed
*/
boolean containsNullAndAllowMultipleNull(Session session, Row newRow);
boolean containsNullAndAllowMultipleNull(SearchRow newRow);
/**
* Compare the positions of two rows.
......
......@@ -237,8 +237,8 @@ public class MultiVersionIndex implements Index {
return base.getType();
}
public boolean containsNullAndAllowMultipleNull(Session session, Row newRow) {
return base.containsNullAndAllowMultipleNull(session, newRow);
public boolean containsNullAndAllowMultipleNull(SearchRow newRow) {
return base.containsNullAndAllowMultipleNull(newRow);
}
public void removeChildrenAndResources(Session session) throws SQLException {
......
......@@ -54,7 +54,7 @@ public class TreeIndex extends BaseIndex {
int compare = compareRows(row, r);
if (compare == 0) {
if (indexType.getUnique()) {
if (!containsNullAndAllowMultipleNull(session, row)) {
if (!containsNullAndAllowMultipleNull(row)) {
throw getDuplicateKeyException();
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论