public function getTableUses($tablename) {

        $uses = array();

        // Check if some foreign key in the whole structure is using it
        // (by comparing the reftable with the tablename)
        if ($this->tables) {
            foreach ($this->tables as $table) {
                $keys = $table->getKeys();
                if ($keys) {
                    foreach ($keys as $key) {
                        if ($key->getType() == XMLDB_KEY_FOREIGN) {
                            if ($tablename == $key->getRefTable()) {
                                $uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
                            }
                        }
                    }
                }
            }
        }

        // Return result
        if (!empty($uses)) {
            return $uses;
        } else {
            return false;
        }
    }
public function getTableUses($tablename) {

        $uses = array();

        // Check if some foreign key in the whole structure is using it
        // (by comparing the reftable with the tablename)
        if ($this->tables) {
            foreach ($this->tables as $table) {
                $keys = $table->getKeys();
                if ($keys) {
                    foreach ($keys as $key) {
                        if ($key->getType() == XMLDB_KEY_FOREIGN) {
                            if ($tablename == $key->getRefTable()) {
                                $uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
                            }
                        }
                    }
                }
            }
        }

        // Return result
        if (!empty($uses)) {
            return $uses;
        } else {
            return false;
        }
    }
public function getTableUses ( $ tablename ) { $ uses = array ( ) ; // Check if some foreign key in the whole structure is using it // (by comparing the reftable with the tablename) if ( $ this -> tables ) { foreach ( $ this -> tables as $ table ) { $ keys = $ table -> getKeys ( ) ; if ( $ keys ) { foreach ( $ keys as $ key ) { if ( $ key -> getType ( ) == XMLDB_KEY_FOREIGN ) { if ( $ tablename == $ key -> getRefTable ( ) ) { $ uses [ ] = 'table ' . $ table -> getName ( ) . ' key ' . $ key -> getName ( ) ; } } } } } } // Return result if ( ! empty ( $ uses ) ) { return $ uses ; } else { return false ; } }
This function returns the number of uses of one table inside
a whole XMLDStructure. Useful to detect if the table must be
locked. Return false if no uses are found.
@param string $tablename
@return mixed
This function returns the number of uses of one table inside a whole XMLDStructure . Useful to detect if the table must be locked . Return false if no uses are found .