/** * drop an existing table * * @param string $name name of the table that should be dropped * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function dropTable($name) { $db = $this->getDBInstance(); if (MDB2::isError($db)) { return $db; } //delete the triggers associated to existing FK constraints $constraints = $this->listTableConstraints($name); if (!MDB2::isError($constraints) && !empty($constraints)) { $db->loadModule('Reverse', null, true); foreach ($constraints as $constraint) { $definition = $db->reverse->getTableConstraintDefinition($name, $constraint); if (!MDB2::isError($definition) && !empty($definition['foreign'])) { $result = $this->_dropFKTriggers($name, $constraint, $definition['references']['table']); if (MDB2::isError($result)) { return $result; } } } } return parent::dropTable($name); }
/** * drop an existing table * * @param string $name name of the table that should be dropped * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function dropTable($name) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } $db->beginNestedTransaction(); $result = $this->_dropAutoincrement($name); if (!PEAR::isError($result)) { $result = parent::dropTable($name); } $db->completeNestedTransaction(); return $result; }
/** * drop an existing table * * @param string $name name of the table that should be dropped * * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function dropTable($name) { $result = $this->_dropAutoincrement($name); if (MDB2::isError($result)) { return $result; } $result = parent::dropTable($name); if (MDB2::isError($result)) { return $result; } $this->_silentCommit(); return $result; }