/** * Tests if the table can be written. Usually, this depends on the * database.checkWritingAllowed method, but some tables (eg. TableLink) * overwrite this default behaviour. */ public void checkWritingAllowed() { database.checkWritingAllowed(); }
@Override public void checkWritingAllowed() { session.getDatabase().checkWritingAllowed(); }
/** * Rename a schema object. * * @param session the session * @param obj the object * @param newName the new name */ public void renameSchemaObject(ServerSession session, SchemaObject obj, String newName) { checkWritingAllowed(); obj.getSchema().rename(obj, newName); updateMetaAndFirstLevelChildren(session, obj); }
/** * Add a schema object to the database. * * @param session the session * @param obj the object to add */ public void addSchemaObject(ServerSession session, SchemaObject obj) { int id = obj.getId(); if (id > 0 && !starting) { checkWritingAllowed(); } // lockMeta(session); obj.getSchema().add(obj); addMeta(session, obj); }
/** * Add an object to the database. * * @param session the session * @param obj the object to add */ public void addDatabaseObject(ServerSession session, DbObject obj) { int id = obj.getId(); if (id > 0 && !starting) { checkWritingAllowed(); } DbObjectType type = obj.getType(); synchronized (getLock(type)) { Map<String, DbObject> map = getMap(type); String name = obj.getName(); if (SysProperties.CHECK && map.get(name) != null) { DbException.throwInternalError("object already exists"); } // lockMeta(session); addMeta(session, obj); map.put(name, obj); } }
checkWritingAllowed(); DbObjectType type = obj.getType(); synchronized (getLock(type)) {
/** * Remove the object from the database. * * @param session the session * @param obj the object to remove */ public void removeDatabaseObject(ServerSession session, DbObject obj) { checkWritingAllowed(); String objName = obj.getName(); DbObjectType type = obj.getType(); synchronized (getLock(type)) { Map<String, DbObject> map = getMap(type); if (SysProperties.CHECK && !map.containsKey(objName)) { DbException.throwInternalError("not found: " + objName); } Comment comment = findComment(obj); // lockMeta(session); if (comment != null) { removeDatabaseObject(session, comment); } int id = obj.getId(); obj.removeChildrenAndResources(session); map.remove(objName); removeMeta(session, id); } }
checkWritingAllowed(); lockMeta(session); Comment comment = findComment(obj);