提交 2e2dfda1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Replace some init methods with constructors

上级 498e99ba
...@@ -64,7 +64,7 @@ public abstract class Constraint extends SchemaObjectBase implements ...@@ -64,7 +64,7 @@ public abstract class Constraint extends SchemaObjectBase implements
protected Table table; protected Table table;
Constraint(Schema schema, int id, String name, Table table) { Constraint(Schema schema, int id, String name, Table table) {
initSchemaObjectBase(schema, id, name, Trace.CONSTRAINT); super(schema, id, name, Trace.CONSTRAINT);
this.table = table; this.table = table;
this.setTemporary(table.isTemporary()); this.setTemporary(table.isTemporary());
} }
......
...@@ -20,7 +20,7 @@ public class Comment extends DbObjectBase { ...@@ -20,7 +20,7 @@ public class Comment extends DbObjectBase {
private String commentText; private String commentText;
public Comment(Database database, int id, DbObject obj) { public Comment(Database database, int id, DbObject obj) {
initDbObjectBase(database, id, getKey(obj), Trace.DATABASE); super(database, id, getKey(obj), Trace.DATABASE);
this.objectType = obj.getType(); this.objectType = obj.getType();
this.objectName = obj.getSQL(); this.objectName = obj.getSQL();
} }
......
...@@ -43,7 +43,7 @@ public abstract class DbObjectBase implements DbObject { ...@@ -43,7 +43,7 @@ public abstract class DbObjectBase implements DbObject {
* @param name the name * @param name the name
* @param traceModuleId the trace module id * @param traceModuleId the trace module id
*/ */
protected void initDbObjectBase(Database db, int objectId, String name, protected DbObjectBase(Database db, int objectId, String name,
int traceModuleId) { int traceModuleId) {
this.database = db; this.database = db;
this.trace = db.getTrace(traceModuleId); this.trace = db.getTrace(traceModuleId);
......
...@@ -47,7 +47,7 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -47,7 +47,7 @@ public class FunctionAlias extends SchemaObjectBase {
private boolean bufferResultSetToLocalTemp = true; private boolean bufferResultSetToLocalTemp = true;
private FunctionAlias(Schema schema, int id, String name) { private FunctionAlias(Schema schema, int id, String name) {
initSchemaObjectBase(schema, id, name, Trace.FUNCTION); super(schema, id, name, Trace.FUNCTION);
} }
/** /**
......
...@@ -68,14 +68,14 @@ public class Right extends DbObjectBase { ...@@ -68,14 +68,14 @@ public class Right extends DbObjectBase {
private DbObject grantedObject; private DbObject grantedObject;
public Right(Database db, int id, RightOwner grantee, Role grantedRole) { public Right(Database db, int id, RightOwner grantee, Role grantedRole) {
initDbObjectBase(db, id, "RIGHT_" + id, Trace.USER); super(db, id, "RIGHT_" + id, Trace.USER);
this.grantee = grantee; this.grantee = grantee;
this.grantedRole = grantedRole; this.grantedRole = grantedRole;
} }
public Right(Database db, int id, RightOwner grantee, int grantedRight, public Right(Database db, int id, RightOwner grantee, int grantedRight,
DbObject grantedObject) { DbObject grantedObject) {
initDbObjectBase(db, id, Integer.toString(id), Trace.USER); super(db, id, Integer.toString(id), Trace.USER);
this.grantee = grantee; this.grantee = grantee;
this.grantedRight = grantedRight; this.grantedRight = grantedRight;
this.grantedObject = grantedObject; this.grantedObject = grantedObject;
......
...@@ -29,7 +29,7 @@ public abstract class RightOwner extends DbObjectBase { ...@@ -29,7 +29,7 @@ public abstract class RightOwner extends DbObjectBase {
protected RightOwner(Database database, int id, String name, protected RightOwner(Database database, int id, String name,
int traceModuleId) { int traceModuleId) {
initDbObjectBase(database, id, name, traceModuleId); super(database, id, name, traceModuleId);
} }
/** /**
......
...@@ -18,7 +18,7 @@ public class Setting extends DbObjectBase { ...@@ -18,7 +18,7 @@ public class Setting extends DbObjectBase {
private String stringValue; private String stringValue;
public Setting(Database database, int id, String settingName) { public Setting(Database database, int id, String settingName) {
initDbObjectBase(database, id, settingName, Trace.SETTING); super(database, id, settingName, Trace.SETTING);
} }
public void setIntValue(int value) { public void setIntValue(int value) {
......
...@@ -26,7 +26,7 @@ public class UserAggregate extends DbObjectBase { ...@@ -26,7 +26,7 @@ public class UserAggregate extends DbObjectBase {
public UserAggregate(Database db, int id, String name, String className, public UserAggregate(Database db, int id, String name, String className,
boolean force) { boolean force) {
initDbObjectBase(db, id, name, Trace.FUNCTION); super(db, id, name, Trace.FUNCTION);
this.className = className; this.className = className;
if (!force) { if (!force) {
getInstance(); getInstance();
......
...@@ -18,7 +18,7 @@ public class UserDataType extends DbObjectBase { ...@@ -18,7 +18,7 @@ public class UserDataType extends DbObjectBase {
private Column column; private Column column;
public UserDataType(Database database, int id, String name) { public UserDataType(Database database, int id, String name) {
initDbObjectBase(database, id, name, Trace.DATABASE); super(database, id, name, Trace.DATABASE);
} }
@Override @Override
......
...@@ -35,8 +35,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -35,8 +35,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
protected IndexColumn[] indexColumns; protected IndexColumn[] indexColumns;
protected Column[] columns; protected Column[] columns;
protected int[] columnIds; protected int[] columnIds;
protected Table table; protected final Table table;
protected IndexType indexType; protected final IndexType indexType;
/** /**
* Initialize the base index. * Initialize the base index.
...@@ -48,9 +48,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -48,9 +48,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
* not yet known * not yet known
* @param newIndexType the index type * @param newIndexType the index type
*/ */
protected void initBaseIndex(Table newTable, int id, String name, protected BaseIndex(Table newTable, int id, String name,
IndexColumn[] newIndexColumns, IndexType newIndexType) { IndexColumn[] newIndexColumns, IndexType newIndexType) {
initSchemaObjectBase(newTable.getSchema(), id, name, Trace.INDEX); super(newTable.getSchema(), id, name, Trace.INDEX);
this.indexType = newIndexType; this.indexType = newIndexType;
this.table = newTable; this.table = newTable;
if (newIndexColumns != null) { if (newIndexColumns != null) {
......
...@@ -24,7 +24,7 @@ public class FunctionIndex extends BaseIndex { ...@@ -24,7 +24,7 @@ public class FunctionIndex extends BaseIndex {
private final FunctionTable functionTable; private final FunctionTable functionTable;
public FunctionIndex(FunctionTable functionTable, IndexColumn[] columns) { public FunctionIndex(FunctionTable functionTable, IndexColumn[] columns) {
initBaseIndex(functionTable, 0, null, columns, IndexType.createNonUnique(true)); super(functionTable, 0, null, columns, IndexType.createNonUnique(true));
this.functionTable = functionTable; this.functionTable = functionTable;
} }
......
...@@ -33,7 +33,7 @@ public class HashIndex extends BaseIndex { ...@@ -33,7 +33,7 @@ public class HashIndex extends BaseIndex {
public HashIndex(RegularTable table, int id, String indexName, public HashIndex(RegularTable table, int id, String indexName,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
initBaseIndex(table, id, indexName, columns, indexType); super(table, id, indexName, columns, indexType);
this.indexColumn = columns[0].column.getColumnId(); this.indexColumn = columns[0].column.getColumnId();
this.tableData = table; this.tableData = table;
reset(); reset();
......
...@@ -37,7 +37,7 @@ public class LinkedIndex extends BaseIndex { ...@@ -37,7 +37,7 @@ public class LinkedIndex extends BaseIndex {
public LinkedIndex(TableLink table, int id, IndexColumn[] columns, public LinkedIndex(TableLink table, int id, IndexColumn[] columns,
IndexType indexType) { IndexType indexType) {
initBaseIndex(table, id, null, columns, indexType); super(table, id, null, columns, indexType);
link = table; link = table;
targetTableName = link.getQualifiedTable(); targetTableName = link.getQualifiedTable();
} }
......
...@@ -26,7 +26,7 @@ public class MetaIndex extends BaseIndex { ...@@ -26,7 +26,7 @@ public class MetaIndex extends BaseIndex {
private final boolean scan; private final boolean scan;
public MetaIndex(MetaTable meta, IndexColumn[] columns, boolean scan) { public MetaIndex(MetaTable meta, IndexColumn[] columns, boolean scan) {
initBaseIndex(meta, 0, null, columns, IndexType.createNonUnique(true)); super(meta, 0, null, columns, IndexType.createNonUnique(true));
this.meta = meta; this.meta = meta;
this.scan = scan; this.scan = scan;
} }
......
...@@ -38,7 +38,7 @@ public class NonUniqueHashIndex extends BaseIndex { ...@@ -38,7 +38,7 @@ public class NonUniqueHashIndex extends BaseIndex {
public NonUniqueHashIndex(RegularTable table, int id, String indexName, public NonUniqueHashIndex(RegularTable table, int id, String indexName,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
initBaseIndex(table, id, indexName, columns, indexType); super(table, id, indexName, columns, indexType);
this.indexColumn = columns[0].column.getColumnId(); this.indexColumn = columns[0].column.getColumnId();
this.tableData = table; this.tableData = table;
reset(); reset();
......
...@@ -43,7 +43,7 @@ public class PageBtreeIndex extends PageIndex { ...@@ -43,7 +43,7 @@ public class PageBtreeIndex extends PageIndex {
public PageBtreeIndex(RegularTable table, int id, String indexName, public PageBtreeIndex(RegularTable table, int id, String indexName,
IndexColumn[] columns, IndexColumn[] columns,
IndexType indexType, boolean create, Session session) { IndexType indexType, boolean create, Session session) {
initBaseIndex(table, id, indexName, columns, indexType); super(table, id, indexName, columns, indexType);
if (!database.isStarting() && create) { if (!database.isStarting() && create) {
checkIndexColumnTypes(columns); checkIndexColumnTypes(columns);
} }
......
...@@ -47,7 +47,7 @@ public class PageDataIndex extends PageIndex { ...@@ -47,7 +47,7 @@ public class PageDataIndex extends PageIndex {
public PageDataIndex(RegularTable table, int id, IndexColumn[] columns, public PageDataIndex(RegularTable table, int id, IndexColumn[] columns,
IndexType indexType, boolean create, Session session) { IndexType indexType, boolean create, Session session) {
initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType); super(table, id, table.getName() + "_DATA", columns, indexType);
// trace = database.getTrace(Trace.PAGE_STORE + "_di"); // trace = database.getTrace(Trace.PAGE_STORE + "_di");
// trace.setLevel(TraceSystem.DEBUG); // trace.setLevel(TraceSystem.DEBUG);
......
...@@ -27,9 +27,9 @@ public class PageDelegateIndex extends PageIndex { ...@@ -27,9 +27,9 @@ public class PageDelegateIndex extends PageIndex {
public PageDelegateIndex(RegularTable table, int id, String name, public PageDelegateIndex(RegularTable table, int id, String name,
IndexType indexType, PageDataIndex mainIndex, boolean create, IndexType indexType, PageDataIndex mainIndex, boolean create,
Session session) { Session session) {
IndexColumn[] cols = IndexColumn.wrap( super(table, id, name,
new Column[] { table.getColumn(mainIndex.getMainIndexColumn())}); IndexColumn.wrap(new Column[] { table.getColumn(mainIndex.getMainIndexColumn()) }),
this.initBaseIndex(table, id, name, cols, indexType); indexType);
this.mainIndex = mainIndex; this.mainIndex = mainIndex;
if (!database.isPersistent() || id < 0) { if (!database.isPersistent() || id < 0) {
throw DbException.throwInternalError(name); throw DbException.throwInternalError(name);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
*/ */
package org.h2.index; package org.h2.index;
import org.h2.table.IndexColumn;
import org.h2.table.Table;
/** /**
* A page store index. * A page store index.
...@@ -18,6 +20,20 @@ public abstract class PageIndex extends BaseIndex { ...@@ -18,6 +20,20 @@ public abstract class PageIndex extends BaseIndex {
private boolean sortedInsertMode; private boolean sortedInsertMode;
/**
* Initialize the page store index.
*
* @param newTable the table
* @param id the object id
* @param name the index name
* @param newIndexColumns the columns that are indexed or null if this is
* not yet known
* @param newIndexType the index type
*/
protected PageIndex(Table newTable, int id, String name, IndexColumn[] newIndexColumns, IndexType newIndexType) {
super(newTable, id, name, newIndexColumns, newIndexType);
}
/** /**
* Get the root page of this index. * Get the root page of this index.
* *
......
...@@ -24,7 +24,7 @@ public class RangeIndex extends BaseIndex { ...@@ -24,7 +24,7 @@ public class RangeIndex extends BaseIndex {
private final RangeTable rangeTable; private final RangeTable rangeTable;
public RangeIndex(RangeTable table, IndexColumn[] columns) { public RangeIndex(RangeTable table, IndexColumn[] columns) {
initBaseIndex(table, 0, "RANGE_INDEX", columns, super(table, 0, "RANGE_INDEX", columns,
IndexType.createNonUnique(true)); IndexType.createNonUnique(true));
this.rangeTable = table; this.rangeTable = table;
} }
......
...@@ -35,7 +35,7 @@ public class ScanIndex extends BaseIndex { ...@@ -35,7 +35,7 @@ public class ScanIndex extends BaseIndex {
public ScanIndex(RegularTable table, int id, IndexColumn[] columns, public ScanIndex(RegularTable table, int id, IndexColumn[] columns,
IndexType indexType) { IndexType indexType) {
initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType); super(table, id, table.getName() + "_DATA", columns, indexType);
tableData = table; tableData = table;
} }
......
...@@ -58,6 +58,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex { ...@@ -58,6 +58,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
public SpatialTreeIndex(Table table, int id, String indexName, public SpatialTreeIndex(Table table, int id, String indexName,
IndexColumn[] columns, IndexType indexType, boolean persistent, IndexColumn[] columns, IndexType indexType, boolean persistent,
boolean create, Session session) { boolean create, Session session) {
super(table, id, indexName, columns, indexType);
if (indexType.isUnique()) { if (indexType.isUnique()) {
throw DbException.getUnsupportedException("not unique"); throw DbException.getUnsupportedException("not unique");
} }
...@@ -81,9 +82,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex { ...@@ -81,9 +82,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
throw DbException.getUnsupportedException( throw DbException.getUnsupportedException(
"cannot do nulls last"); "cannot do nulls last");
} }
initBaseIndex(table, id, indexName, columns, indexType);
this.needRebuild = create; this.needRebuild = create;
this.table = table;
if (!database.isStarting()) { if (!database.isStarting()) {
if (columns[0].column.getType() != Value.GEOMETRY) { if (columns[0].column.getType() != Value.GEOMETRY) {
throw DbException.getUnsupportedException( throw DbException.getUnsupportedException(
......
...@@ -30,7 +30,7 @@ public class TreeIndex extends BaseIndex { ...@@ -30,7 +30,7 @@ public class TreeIndex extends BaseIndex {
public TreeIndex(RegularTable table, int id, String indexName, public TreeIndex(RegularTable table, int id, String indexName,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
initBaseIndex(table, id, indexName, columns, indexType); super(table, id, indexName, columns, indexType);
tableData = table; tableData = table;
if (!database.isStarting()) { if (!database.isStarting()) {
checkIndexColumnTypes(columns); checkIndexColumnTypes(columns);
......
...@@ -64,7 +64,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex { ...@@ -64,7 +64,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex {
*/ */
public ViewIndex(TableView view, String querySQL, public ViewIndex(TableView view, String querySQL,
ArrayList<Parameter> originalParameters, boolean recursive) { ArrayList<Parameter> originalParameters, boolean recursive) {
initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false)); super(view, 0, null, null, IndexType.createNonUnique(false));
this.view = view; this.view = view;
this.querySQL = querySQL; this.querySQL = querySQL;
this.originalParameters = originalParameters; this.originalParameters = originalParameters;
...@@ -91,7 +91,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex { ...@@ -91,7 +91,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex {
*/ */
public ViewIndex(TableView view, ViewIndex index, Session session, public ViewIndex(TableView view, ViewIndex index, Session session,
int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder) { int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder) {
initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false)); super(view, 0, null, null, IndexType.createNonUnique(false));
this.view = view; this.view = view;
this.querySQL = index.querySQL; this.querySQL = index.querySQL;
this.originalParameters = index.originalParameters; this.originalParameters = index.originalParameters;
......
...@@ -30,9 +30,9 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex { ...@@ -30,9 +30,9 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
public MVDelegateIndex(MVTable table, int id, String name, public MVDelegateIndex(MVTable table, int id, String name,
MVPrimaryIndex mainIndex, MVPrimaryIndex mainIndex,
IndexType indexType) { IndexType indexType) {
IndexColumn[] cols = IndexColumn.wrap(new Column[] { table super(table, id, name,
.getColumn(mainIndex.getMainIndexColumn()) }); IndexColumn.wrap(new Column[] { table.getColumn(mainIndex.getMainIndexColumn()) }),
this.initBaseIndex(table, id, name, cols, indexType); indexType);
this.mainIndex = mainIndex; this.mainIndex = mainIndex;
if (id < 0) { if (id < 0) {
throw DbException.throwInternalError(name); throw DbException.throwInternalError(name);
......
...@@ -45,8 +45,8 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -45,8 +45,8 @@ public class MVPrimaryIndex extends BaseIndex {
public MVPrimaryIndex(Database db, MVTable table, int id, public MVPrimaryIndex(Database db, MVTable table, int id,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
super(table, id, table.getName() + "_DATA", columns, indexType);
this.mvTable = table; this.mvTable = table;
initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType);
int[] sortTypes = new int[columns.length]; int[] sortTypes = new int[columns.length];
for (int i = 0; i < columns.length; i++) { for (int i = 0; i < columns.length; i++) {
sortTypes[i] = SortOrder.ASCENDING; sortTypes[i] = SortOrder.ASCENDING;
......
...@@ -48,8 +48,8 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex { ...@@ -48,8 +48,8 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
public MVSecondaryIndex(Database db, MVTable table, int id, String indexName, public MVSecondaryIndex(Database db, MVTable table, int id, String indexName,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
super(table, id, indexName, columns, indexType);
this.mvTable = table; this.mvTable = table;
initBaseIndex(table, id, indexName, columns, indexType);
if (!database.isStarting()) { if (!database.isStarting()) {
checkIndexColumnTypes(columns); checkIndexColumnTypes(columns);
} }
......
...@@ -65,6 +65,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -65,6 +65,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
public MVSpatialIndex( public MVSpatialIndex(
Database db, MVTable table, int id, String indexName, Database db, MVTable table, int id, String indexName,
IndexColumn[] columns, IndexType indexType) { IndexColumn[] columns, IndexType indexType) {
super(table, id, indexName, columns, indexType);
if (columns.length != 1) { if (columns.length != 1) {
throw DbException.getUnsupportedException( throw DbException.getUnsupportedException(
"Can only index one column"); "Can only index one column");
...@@ -88,7 +89,6 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -88,7 +89,6 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
+ col.column.getCreateSQL()); + col.column.getCreateSQL());
} }
this.mvTable = table; this.mvTable = table;
initBaseIndex(table, id, indexName, columns, indexType);
if (!database.isStarting()) { if (!database.isStarting()) {
checkIndexColumnTypes(columns); checkIndexColumnTypes(columns);
} }
......
...@@ -23,7 +23,7 @@ public class Constant extends SchemaObjectBase { ...@@ -23,7 +23,7 @@ public class Constant extends SchemaObjectBase {
private ValueExpression expression; private ValueExpression expression;
public Constant(Schema schema, int id, String name) { public Constant(Schema schema, int id, String name) {
initSchemaObjectBase(schema, id, name, Trace.SCHEMA); super(schema, id, name, Trace.SCHEMA);
} }
@Override @Override
......
...@@ -73,6 +73,7 @@ public class Schema extends DbObjectBase { ...@@ -73,6 +73,7 @@ public class Schema extends DbObjectBase {
*/ */
public Schema(Database database, int id, String schemaName, User owner, public Schema(Database database, int id, String schemaName, User owner,
boolean system) { boolean system) {
super(database, id, schemaName, Trace.SCHEMA);
tablesAndViews = database.newConcurrentStringMap(); tablesAndViews = database.newConcurrentStringMap();
synonyms = database.newConcurrentStringMap(); synonyms = database.newConcurrentStringMap();
indexes = database.newConcurrentStringMap(); indexes = database.newConcurrentStringMap();
...@@ -81,7 +82,6 @@ public class Schema extends DbObjectBase { ...@@ -81,7 +82,6 @@ public class Schema extends DbObjectBase {
constraints = database.newConcurrentStringMap(); constraints = database.newConcurrentStringMap();
constants = database.newConcurrentStringMap(); constants = database.newConcurrentStringMap();
functions = database.newConcurrentStringMap(); functions = database.newConcurrentStringMap();
initDbObjectBase(database, id, schemaName, Trace.SCHEMA);
this.owner = owner; this.owner = owner;
this.system = system; this.system = system;
} }
......
...@@ -13,7 +13,7 @@ import org.h2.engine.DbObjectBase; ...@@ -13,7 +13,7 @@ import org.h2.engine.DbObjectBase;
public abstract class SchemaObjectBase extends DbObjectBase implements public abstract class SchemaObjectBase extends DbObjectBase implements
SchemaObject { SchemaObject {
private Schema schema; private final Schema schema;
/** /**
* Initialize some attributes of this object. * Initialize some attributes of this object.
...@@ -23,9 +23,9 @@ public abstract class SchemaObjectBase extends DbObjectBase implements ...@@ -23,9 +23,9 @@ public abstract class SchemaObjectBase extends DbObjectBase implements
* @param name the name * @param name the name
* @param traceModuleId the trace module id * @param traceModuleId the trace module id
*/ */
protected void initSchemaObjectBase(Schema newSchema, int id, String name, protected SchemaObjectBase(Schema newSchema, int id, String name,
int traceModuleId) { int traceModuleId) {
initDbObjectBase(newSchema.getDatabase(), id, name, traceModuleId); super(newSchema.getDatabase(), id, name, traceModuleId);
this.schema = newSchema; this.schema = newSchema;
} }
......
...@@ -67,7 +67,7 @@ public class Sequence extends SchemaObjectBase { ...@@ -67,7 +67,7 @@ public class Sequence extends SchemaObjectBase {
public Sequence(Schema schema, int id, String name, Long startValue, public Sequence(Schema schema, int id, String name, Long startValue,
Long increment, Long cacheSize, Long minValue, Long maxValue, Long increment, Long cacheSize, Long minValue, Long maxValue,
boolean cycle, boolean belongsToTable) { boolean cycle, boolean belongsToTable) {
initSchemaObjectBase(schema, id, name, Trace.SEQUENCE); super(schema, id, name, Trace.SEQUENCE);
this.increment = increment != null ? this.increment = increment != null ?
increment : 1; increment : 1;
this.minValue = minValue != null ? this.minValue = minValue != null ?
......
...@@ -52,7 +52,7 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -52,7 +52,7 @@ public class TriggerObject extends SchemaObjectBase {
private Trigger triggerCallback; private Trigger triggerCallback;
public TriggerObject(Schema schema, int id, String name, Table table) { public TriggerObject(Schema schema, int id, String name, Table table) {
initSchemaObjectBase(schema, id, name, Trace.TRIGGER); super(schema, id, name, Trace.TRIGGER);
this.table = table; this.table = table;
setTemporary(table.isTemporary()); setTemporary(table.isTemporary());
} }
......
...@@ -95,8 +95,8 @@ public abstract class Table extends SchemaObjectBase { ...@@ -95,8 +95,8 @@ public abstract class Table extends SchemaObjectBase {
public Table(Schema schema, int id, String name, boolean persistIndexes, public Table(Schema schema, int id, String name, boolean persistIndexes,
boolean persistData) { boolean persistData) {
super(schema, id, name, Trace.TABLE);
columnMap = schema.getDatabase().newStringMap(); columnMap = schema.getDatabase().newStringMap();
initSchemaObjectBase(schema, id, name, Trace.TABLE);
this.persistIndexes = persistIndexes; this.persistIndexes = persistIndexes;
this.persistData = persistData; this.persistData = persistData;
compareMode = schema.getDatabase().getCompareMode(); compareMode = schema.getDatabase().getCompareMode();
......
...@@ -26,7 +26,7 @@ public class TableSynonym extends SchemaObjectBase { ...@@ -26,7 +26,7 @@ public class TableSynonym extends SchemaObjectBase {
private Table synonymFor; private Table synonymFor;
public TableSynonym(CreateSynonymData data) { public TableSynonym(CreateSynonymData data) {
initSchemaObjectBase(data.schema, data.id, data.synonymName, Trace.TABLE); super(data.schema, data.id, data.synonymName, Trace.TABLE);
this.data = data; this.data = data;
} }
......
...@@ -920,7 +920,7 @@ public class TestTableEngines extends TestDb { ...@@ -920,7 +920,7 @@ public class TestTableEngines extends TestDb {
public class Scan extends BaseIndex { public class Scan extends BaseIndex {
Scan(Table table) { Scan(Table table) {
initBaseIndex(table, table.getId(), table.getName() + "_SCAN", super(table, table.getId(), table.getName() + "_SCAN",
IndexColumn.wrap(table.getColumns()), IndexType.createScan(false)); IndexColumn.wrap(table.getColumns()), IndexType.createScan(false));
} }
...@@ -1145,7 +1145,7 @@ public class TestTableEngines extends TestDb { ...@@ -1145,7 +1145,7 @@ public class TestTableEngines extends TestDb {
*/ */
public class AffinityIndex extends BaseIndex { public class AffinityIndex extends BaseIndex {
AffinityIndex(Table table, int id, String name, IndexColumn[] newIndexColumns) { AffinityIndex(Table table, int id, String name, IndexColumn[] newIndexColumns) {
initBaseIndex(table, id, name, newIndexColumns, IndexType.createAffinity()); super(table, id, name, newIndexColumns, IndexType.createAffinity());
} }
@Override @Override
...@@ -1534,7 +1534,7 @@ public class TestTableEngines extends TestDb { ...@@ -1534,7 +1534,7 @@ public class TestTableEngines extends TestDb {
final TreeSet<SearchRow> set = new TreeSet<>(this); final TreeSet<SearchRow> set = new TreeSet<>(this);
TreeSetIndex(Table t, String name, IndexColumn[] cols, IndexType type) { TreeSetIndex(Table t, String name, IndexColumn[] cols, IndexType type) {
initBaseIndex(t, 0, name, cols, type); super(t, 0, name, cols, type);
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论