Changeset 7685

Show
Ignore:
Timestamp:
06/29/06 11:27:41 (2 years ago)
Author:
richie
Message:

fixed the innodb and foreign key issue by srini

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vtigercrm/trunk/adodb/adodb-datadict.inc.php

    r7186 r7685  
    710710        have to know if the col is new or not. It will check on its own. 
    711711        */ 
    712         function ChangeTableSQL($tablename, $flds, $tableoptions = false) 
     712        function ChangeTableSQL($tablename, $flds, $tableoptions = false, $forceAlter = false) // GS Fix for constraint impl - forceAlter 
    713713        { 
    714714        global $ADODB_FETCH_MODE; 
     
    727727                $ADODB_FETCH_MODE = $save; 
    728728                 
    729                 if ( empty($cols)) {  
     729                if ( $forceAlter == false && empty($cols)) { // GS Fix for constraint impl 
    730730                        return $this->CreateTableSQL($tablename, $flds, $tableoptions); 
    731731                } 
     
    778778                        } 
    779779                } 
    780                  
    781                 return $sql; 
     780 
     781                // GS Fix for constraint impl -- start 
     782                if($forceAlter == false) return $sql; 
     783                $sqlarray = array(); 
     784 
     785                $alter .= implode(",\n", $sql); 
     786                if (sizeof($pkey)>0) { 
     787                        $alter .= ",\n PRIMARY KEY ("; 
     788                        $alter .= implode(", ",$pkey).")"; 
     789                } 
     790                 
     791                if (isset($tableoptions['CONSTRAINTS']))  
     792                        $alter .= "\n".$tableoptions['CONSTRAINTS']; 
     793 
     794                if (isset($tableoptions[$this->upperName.'_CONSTRAINTS']))  
     795                        $alter .= "\n".$tableoptions[$this->upperName.'_CONSTRAINTS']; 
     796 
     797                if (isset($tableoptions[$this->upperName])) $alter .= $tableoptions[$this->upperName]; 
     798                        $sqlarray[] = $alter; 
     799 
     800                 
     801                $taboptions = $this->_Options($tableoptions); 
     802                $tsql = $this->_Triggers($this->TableName($tablename),$taboptions); 
     803                foreach($tsql as $s) $sqlarray[] = $s; 
     804 
     805                // GS Fix for constraint impl -- end 
     806                 
     807                return $sqlarray; 
     808 
     809                 
    782810        } 
    783811} // class