Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }