當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLDBField::getName方法代碼示例

本文整理匯總了PHP中XMLDBField::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDBField::getName方法的具體用法?PHP XMLDBField::getName怎麽用?PHP XMLDBField::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLDBField的用法示例。


在下文中一共展示了XMLDBField::getName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRenameTableExtraSQL

 /**
  * Returns the code (array of statements) needed to execute extra statements on table rename
  */
 function getRenameTableExtraSQL($xmldb_table, $newname)
 {
     $results = array();
     $xmldb_field = new XMLDBField('id');
     // Fields having sequences should be exclusively, id.
     $oldseqname = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'seq');
     $newseqname = $this->getNameForObject($newname, $xmldb_field->getName(), 'seq');
     /// Rename de sequence
     $results[] = 'RENAME ' . $oldseqname . ' TO ' . $newseqname;
     $oldtriggername = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'trg');
     $newtriggername = $this->getNameForObject($newname, $xmldb_field->getName(), 'trg');
     /// Drop old trigger
     $results[] = "DROP TRIGGER " . $oldtriggername;
     $newt = new XMLDBTable($newname);
     /// Temp table for trigger code generation
     /// Create new trigger
     $results = array_merge($results, $this->getCreateTriggerSQL($newt, $xmldb_field));
     /// Rename all the check constraints in the table
     $oldtablename = $this->getTableName($xmldb_table);
     $newtablename = $this->getTableName($newt);
     $oldconstraintprefix = $this->getNameForObject($xmldb_table->getName(), '');
     $newconstraintprefix = $this->getNameForObject($newt->getName(), '', '');
     if ($constraints = $this->getCheckConstraintsFromDB($xmldb_table)) {
         foreach ($constraints as $constraint) {
             /// Drop the old constraint
             $results[] = 'ALTER TABLE ' . $newtablename . ' DROP CONSTRAINT ' . $constraint->name;
             /// Calculate the new constraint name
             $newconstraintname = str_replace($oldconstraintprefix, $newconstraintprefix, $constraint->name);
             /// Add the new constraint
             $results[] = 'ALTER TABLE ' . $newtablename . ' ADD CONSTRAINT ' . $newconstraintname . ' CHECK (' . $constraint->description . ')';
         }
     }
     return $results;
 }
開發者ID:Br3nda,項目名稱:mahara,代碼行數:37,代碼來源:oci8po.class.php


注:本文中的XMLDBField::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。