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

remove unnecessary parameter

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