当前位置: 首页>>代码示例>>PHP>>正文


PHP ForeignKey::getName方法代码示例

本文整理汇总了PHP中ForeignKey::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKey::getName方法的具体用法?PHP ForeignKey::getName怎么用?PHP ForeignKey::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ForeignKey的用法示例。


在下文中一共展示了ForeignKey::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDropForeignKeyDDL

 public function getDropForeignKeyDDL(ForeignKey $fk)
 {
     if ($fk->isSkipSql()) {
         return;
     }
     $pattern = "\nALTER TABLE %s DROP FOREIGN KEY %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($fk->getTable()->getName()), $this->quoteIdentifier($fk->getName()));
 }
开发者ID:rubensayshi,项目名称:propelsandbox,代码行数:8,代码来源:MysqlPlatform.php

示例2: getForeignKeyDDL

 public function getForeignKeyDDL(ForeignKey $fk)
 {
     if ($fk->isSkipSql()) {
         return;
     }
     $pattern = 'CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)';
     $script = sprintf($pattern, $this->quoteIdentifier($fk->getName()), $this->getColumnListDDL($fk->getLocalColumns()), $this->quoteIdentifier($fk->getForeignTableName()), $this->getColumnListDDL($fk->getForeignColumns()));
     if ($fk->hasOnUpdate() && $fk->getOnUpdate() != ForeignKey::SETNULL) {
         $script .= ' ON UPDATE ' . $fk->getOnUpdate();
     }
     if ($fk->hasOnDelete() && $fk->getOnDelete() != ForeignKey::SETNULL) {
         $script .= ' ON DELETE ' . $fk->getOnDelete();
     }
     return $script;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:15,代码来源:MssqlPlatform.php

示例3: parse

 /**
  * @param string $stmt
  * @return $this
  */
 public function parse($stmt)
 {
     $lines = array_map('trim', explode(PHP_EOL, $stmt));
     $this->first = array_shift($lines);
     $last = array_pop($lines);
     //remove AUTO_INCREMENT bit from raw statement
     $this->last = preg_replace('/AUTO_INCREMENT=\\d+ ?/', '', $last);
     $this->statement = str_replace($last, $this->last, $stmt);
     if ($this->name === null) {
         if (!preg_match('/`([^`]+)/', $this->first, $match)) {
             throw new \RuntimeException(sprintf('Unable to extract name from %s (looked at line %s)', $stmt, $lines[0]));
         }
         $this->name = $match[1];
     }
     foreach ($lines as $ln) {
         if (mb_substr($ln, -1) == ',') {
             $ln = mb_substr($ln, 0, -1);
         }
         //field lines start with back-tick
         switch ($ln[0]) {
             case '`':
                 $field = new Field($ln);
                 $this->fields[$field->getName()] = $field;
                 break;
             case 'P':
                 $this->primary = new Primary($ln);
                 break;
             case 'S':
                 //spatial
             //spatial
             case 'U':
                 //unique
             //unique
             case 'F':
                 //fulltext
             //fulltext
             case 'I':
                 //index
             //index
             case 'K':
                 //Key
                 $idx = new Index($ln);
                 $this->indexes[$idx->getName()] = $idx;
                 break;
             case 'C':
                 $constraint = new ForeignKey($ln);
                 $this->constraints[$constraint->getName()] = $constraint;
                 break;
             default:
                 throw new \LogicException(sprintf('Unable to parse line %s in %s', $ln, $stmt));
         }
     }
     return $this;
 }
开发者ID:rimantoro,项目名称:mysql-diff,代码行数:58,代码来源:Table.php

示例4: getForeignKeyDDL

 public function getForeignKeyDDL(ForeignKey $fk)
 {
     if ($fk->isSkipSql()) {
         return;
     }
     $pattern = "CONSTRAINT %s\r\n    FOREIGN KEY (%s) REFERENCES %s (%s)";
     $script = sprintf($pattern, $this->quoteIdentifier($fk->getName()), $this->getColumnListDDL($fk->getLocalColumns()), $this->quoteIdentifier($fk->getForeignTableName()), $this->getColumnListDDL($fk->getForeignColumns()));
     if ($fk->hasOnDelete()) {
         $script .= "\r\n    ON DELETE " . $fk->getOnDelete();
     }
     return $script;
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:12,代码来源:OraclePlatform.php

示例5: addForeignKey

 /**
  * @param ForeignKey $foreignKey
  */
 public function addForeignKey(ForeignKey $foreignKey)
 {
     $foreignKey->setParentTable($this);
     $this->foreignKeys[$foreignKey->getName()] = $foreignKey;
 }
开发者ID:camcima,项目名称:php-mysql-diff,代码行数:8,代码来源:Table.php

示例6: addChangedForeignKey

 /**
  * @param ForeignKey $changedForeignKey
  */
 public function addChangedForeignKey(ForeignKey $changedForeignKey)
 {
     $this->changedForeignKeys[$changedForeignKey->getName()] = $changedForeignKey;
 }
开发者ID:camcima,项目名称:php-mysql-diff,代码行数:7,代码来源:ChangedTable.php


注:本文中的ForeignKey::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。