提交 1487876f authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

rename Database#update to Database#updateMeta for symmetry with the other meta related methods

上级 6cb91c1b
...@@ -53,7 +53,7 @@ public class AlterSchemaRename extends DefineCommand { ...@@ -53,7 +53,7 @@ public class AlterSchemaRename extends DefineCommand {
db.renameDatabaseObject(session, oldSchema, newSchemaName); db.renameDatabaseObject(session, oldSchema, newSchemaName);
ArrayList<SchemaObject> all = db.getAllSchemaObjects(); ArrayList<SchemaObject> all = db.getAllSchemaObjects();
for (SchemaObject schemaObject : all) { for (SchemaObject schemaObject : all) {
db.update(session, schemaObject); db.updateMeta(session, schemaObject);
} }
return 0; return 0;
} }
......
...@@ -102,7 +102,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -102,7 +102,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
} }
checkNoNullValues(); checkNoNullValues();
oldColumn.setNullable(false); oldColumn.setNullable(false);
db.update(session, table); db.updateMeta(session, table);
break; break;
} }
case CommandInterface.ALTER_TABLE_ALTER_COLUMN_NULL: { case CommandInterface.ALTER_TABLE_ALTER_COLUMN_NULL: {
...@@ -112,7 +112,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -112,7 +112,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
} }
checkNullable(); checkNullable();
oldColumn.setNullable(true); oldColumn.setNullable(true);
db.update(session, table); db.updateMeta(session, table);
break; break;
} }
case CommandInterface.ALTER_TABLE_ALTER_COLUMN_DEFAULT: { case CommandInterface.ALTER_TABLE_ALTER_COLUMN_DEFAULT: {
...@@ -120,7 +120,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -120,7 +120,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
oldColumn.setSequence(null); oldColumn.setSequence(null);
oldColumn.setDefaultExpression(session, defaultExpression); oldColumn.setDefaultExpression(session, defaultExpression);
removeSequence(sequence); removeSequence(sequence);
db.update(session, table); db.updateMeta(session, table);
break; break;
} }
case CommandInterface.ALTER_TABLE_ALTER_COLUMN_CHANGE_TYPE: { case CommandInterface.ALTER_TABLE_ALTER_COLUMN_CHANGE_TYPE: {
...@@ -130,7 +130,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -130,7 +130,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
if (oldColumn.isWideningConversion(newColumn)) { if (oldColumn.isWideningConversion(newColumn)) {
convertAutoIncrementColumn(newColumn); convertAutoIncrementColumn(newColumn);
oldColumn.copy(newColumn); oldColumn.copy(newColumn);
db.update(session, table); db.updateMeta(session, table);
} else { } else {
oldColumn.setSequence(null); oldColumn.setSequence(null);
oldColumn.setDefaultExpression(session, null); oldColumn.setDefaultExpression(session, null);
...@@ -173,7 +173,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -173,7 +173,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
case CommandInterface.ALTER_TABLE_ALTER_COLUMN_SELECTIVITY: { case CommandInterface.ALTER_TABLE_ALTER_COLUMN_SELECTIVITY: {
int value = newSelectivity.optimize(session).getValue(session).getInt(); int value = newSelectivity.optimize(session).getValue(session).getInt();
oldColumn.setSelectivity(value); oldColumn.setSelectivity(value);
db.update(session, table); db.updateMeta(session, table);
break; break;
} }
default: default:
......
...@@ -46,7 +46,7 @@ public class AlterTableRename extends SchemaCommand { ...@@ -46,7 +46,7 @@ public class AlterTableRename extends SchemaCommand {
if (!t.isHidden()) { if (!t.isHidden()) {
t.setHidden(hidden); t.setHidden(hidden);
oldTable.setHidden(true); oldTable.setHidden(true);
db.update(session, oldTable); db.updateMeta(session, oldTable);
} }
return 0; return 0;
} }
......
...@@ -53,10 +53,10 @@ public class AlterTableRenameColumn extends DefineCommand { ...@@ -53,10 +53,10 @@ public class AlterTableRenameColumn extends DefineCommand {
column.removeCheckConstraint(); column.removeCheckConstraint();
column.addCheckConstraint(session, newCheckExpr); column.addCheckConstraint(session, newCheckExpr);
table.setModified(); table.setModified();
db.update(session, table); db.updateMeta(session, table);
for (DbObject child : table.getChildren()) { for (DbObject child : table.getChildren()) {
if (child.getCreateSQL() != null) { if (child.getCreateSQL() != null) {
db.update(session, child); db.updateMeta(session, child);
} }
} }
return 0; return 0;
......
...@@ -107,7 +107,7 @@ public class AlterUser extends DefineCommand { ...@@ -107,7 +107,7 @@ public class AlterUser extends DefineCommand {
default: default:
DbException.throwInternalError("type=" + type); DbException.throwInternalError("type=" + type);
} }
db.update(session, user); db.updateMeta(session, user);
return 0; return 0;
} }
......
...@@ -114,7 +114,7 @@ public class Analyze extends DefineCommand { ...@@ -114,7 +114,7 @@ public class Analyze extends DefineCommand {
columns[j].setSelectivity(selectivity); columns[j].setSelectivity(selectivity);
} }
if (manual) { if (manual) {
db.update(session, table); db.updateMeta(session, table);
} else { } else {
Session sysSession = db.getSystemSession(); Session sysSession = db.getSystemSession();
if (sysSession != session) { if (sysSession != session) {
...@@ -122,7 +122,7 @@ public class Analyze extends DefineCommand { ...@@ -122,7 +122,7 @@ public class Analyze extends DefineCommand {
// (which is the case if we are within a trigger) // (which is the case if we are within a trigger)
// then we can't update the statistics because // then we can't update the statistics because
// that would unlock all locked objects // that would unlock all locked objects
db.update(sysSession, table); db.updateMeta(sysSession, table);
sysSession.commit(true); sysSession.commit(true);
} }
} }
......
...@@ -119,7 +119,7 @@ public class CreateView extends SchemaCommand { ...@@ -119,7 +119,7 @@ public class CreateView extends SchemaCommand {
if (old == null) { if (old == null) {
db.addSchemaObject(session, view); db.addSchemaObject(session, view);
} else { } else {
db.update(session, view); db.updateMeta(session, view);
} }
return 0; return 0;
} }
......
...@@ -115,7 +115,7 @@ public class GrantRevoke extends DefineCommand { ...@@ -115,7 +115,7 @@ public class GrantRevoke extends DefineCommand {
db.addDatabaseObject(session, right); db.addDatabaseObject(session, right);
} else { } else {
right.setRightMask(right.getRightMask() | rightMask); right.setRightMask(right.getRightMask() | rightMask);
db.update(session, right); db.updateMeta(session, right);
} }
} }
} }
...@@ -151,7 +151,7 @@ public class GrantRevoke extends DefineCommand { ...@@ -151,7 +151,7 @@ public class GrantRevoke extends DefineCommand {
db.removeDatabaseObject(session, right); db.removeDatabaseObject(session, right);
} else { } else {
right.setRightMask(newRight); right.setRightMask(newRight);
db.update(session, right); db.updateMeta(session, right);
} }
} }
} }
......
...@@ -101,7 +101,7 @@ public class SetComment extends DefineCommand { ...@@ -101,7 +101,7 @@ public class SetComment extends DefineCommand {
objectType == DbObject.USER || objectType == DbObject.USER ||
objectType == DbObject.INDEX || objectType == DbObject.INDEX ||
objectType == DbObject.CONSTRAINT) { objectType == DbObject.CONSTRAINT) {
db.update(session, object); db.updateMeta(session, object);
} else { } else {
Comment comment = db.findComment(object); Comment comment = db.findComment(object);
if (comment == null) { if (comment == null) {
...@@ -118,7 +118,7 @@ public class SetComment extends DefineCommand { ...@@ -118,7 +118,7 @@ public class SetComment extends DefineCommand {
db.removeDatabaseObject(session, comment); db.removeDatabaseObject(session, comment);
} else { } else {
comment.setCommentText(text); comment.setCommentText(text);
db.update(session, comment); db.updateMeta(session, comment);
} }
} }
} }
......
...@@ -104,7 +104,7 @@ public class AlterSequence extends SchemaCommand { ...@@ -104,7 +104,7 @@ public class AlterSequence extends SchemaCommand {
// would keep other transactions from using the sequence // would keep other transactions from using the sequence
Session sysSession = db.getSystemSession(); Session sysSession = db.getSystemSession();
synchronized (sysSession) { synchronized (sysSession) {
db.update(sysSession, sequence); db.updateMeta(sysSession, sequence);
sysSession.commit(true); sysSession.commit(true);
} }
return 0; return 0;
......
...@@ -522,7 +522,7 @@ public class Set extends Prepared { ...@@ -522,7 +522,7 @@ public class Set extends Prepared {
if (addNew) { if (addNew) {
database.addDatabaseObject(session, setting); database.addDatabaseObject(session, setting);
} else { } else {
database.update(session, setting); database.updateMeta(session, setting);
} }
} }
......
...@@ -1564,7 +1564,7 @@ public class Database implements DataHandler { ...@@ -1564,7 +1564,7 @@ public class Database implements DataHandler {
* @param session the session * @param session the session
* @param obj the database object * @param obj the database object
*/ */
public synchronized void update(Session session, DbObject obj) { public synchronized void updateMeta(Session session, DbObject obj) {
lockMeta(session); lockMeta(session);
int id = obj.getId(); int id = obj.getId();
removeMeta(session, id); removeMeta(session, id);
...@@ -1591,12 +1591,12 @@ public class Database implements DataHandler { ...@@ -1591,12 +1591,12 @@ public class Database implements DataHandler {
if (comment != null) { if (comment != null) {
DbException.throwInternalError(); DbException.throwInternalError();
} }
update(session, obj); updateMeta(session, obj);
// remember that this scans only one level deep! // remember that this scans only one level deep!
if (list != null) { if (list != null) {
for (DbObject o : list) { for (DbObject o : list) {
if (o.getCreateSQL() != null) { if (o.getCreateSQL() != null) {
update(session, o); updateMeta(session, o);
} }
} }
} }
......
...@@ -303,7 +303,7 @@ public class Sequence extends SchemaObjectBase { ...@@ -303,7 +303,7 @@ public class Sequence extends SchemaObjectBase {
try { try {
value = valueWithMargin; value = valueWithMargin;
if (!isTemporary()) { if (!isTemporary()) {
database.update(session, this); database.updateMeta(session, this);
} }
} finally { } finally {
value = realValue; value = realValue;
......
...@@ -1029,7 +1029,7 @@ public abstract class Table extends SchemaObjectBase { ...@@ -1029,7 +1029,7 @@ public abstract class Table extends SchemaObjectBase {
for (Constraint cons : constraints) { for (Constraint cons : constraints) {
if (cons.usesIndex(index)) { if (cons.usesIndex(index)) {
cons.setIndexOwner(index); cons.setIndexOwner(index);
database.update(session, cons); database.updateMeta(session, cons);
stillNeeded = true; stillNeeded = true;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论