Search in sources :

Example 1 with Comment

use of com.wplatform.ddal.dbobject.Comment in project jdbc-shards by wplatform.

the class Database method removeDatabaseObject.

/**
 * Remove the object from the database.
 *
 * @param session the session
 * @param obj the object to remove
 */
public synchronized void removeDatabaseObject(Session session, DbObject obj) {
    String objName = obj.getName();
    int type = obj.getType();
    HashMap<String, DbObject> map = getMap(type);
    if (SysProperties.CHECK && !map.containsKey(objName)) {
        DbException.throwInternalError("not found: " + objName);
    }
    Comment comment = findComment(obj);
    if (comment != null) {
        removeDatabaseObject(session, comment);
    }
    obj.removeChildrenAndResources(session);
    map.remove(objName);
}
Also used : Comment(com.wplatform.ddal.dbobject.Comment) DbObject(com.wplatform.ddal.dbobject.DbObject)

Example 2 with Comment

use of com.wplatform.ddal.dbobject.Comment in project jdbc-shards by wplatform.

the class Database method removeSchemaObject.

/**
 * Remove an object from the system table.
 *
 * @param session the session
 * @param obj the object to be removed
 */
public synchronized void removeSchemaObject(Session session, SchemaObject obj) {
    int type = obj.getType();
    if (type == DbObject.TABLE_OR_VIEW) {
        Table table = (Table) obj;
        if (table.isTemporary() && !table.isGlobalTemporary()) {
            session.removeLocalTempTable(table);
            return;
        }
    } else if (type == DbObject.INDEX) {
        Index index = (Index) obj;
        Table table = index.getTable();
        if (table.isTemporary() && !table.isGlobalTemporary()) {
            session.removeLocalTempTableIndex(index);
            return;
        }
    }
    Comment comment = findComment(obj);
    if (comment != null) {
        removeDatabaseObject(session, comment);
    }
    obj.getSchema().remove(obj);
}
Also used : Comment(com.wplatform.ddal.dbobject.Comment) Table(com.wplatform.ddal.dbobject.table.Table) Index(com.wplatform.ddal.dbobject.index.Index)

Aggregations

Comment (com.wplatform.ddal.dbobject.Comment)2 DbObject (com.wplatform.ddal.dbobject.DbObject)1 Index (com.wplatform.ddal.dbobject.index.Index)1 Table (com.wplatform.ddal.dbobject.table.Table)1