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


PHP Database::getTablesForSql方法代码示例

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


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

示例1: getAddTablesDDL

 /**
  * Returns the DDL SQL to add the tables of a database
  * together with index and foreign keys. 
  * Since MSSQL always checks it the tables in foreign key definitions exist, 
  * the foreign key DDLs are moved after all tables are created
  *
  * @return string
  */
 public function getAddTablesDDL(Database $database)
 {
     $ret = $this->getBeginDDL();
     foreach ($database->getTablesForSql() as $table) {
         $this->normalizeTable($table);
     }
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getCommentBlockDDL($table->getName());
         $ret .= $this->getDropTableDDL($table);
         $ret .= $this->getAddTableDDL($table);
         $ret .= $this->getAddIndicesDDL($table);
     }
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getAddForeignKeysDDL($table);
     }
     $ret .= $this->getEndDDL();
     return $ret;
 }
开发者ID:naldz,项目名称:cyberden,代码行数:26,代码来源:MssqlPlatform.php

示例2: getAddTablesDDL

 public function getAddTablesDDL(Database $database)
 {
     $ret = '';
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getCommentBlockDDL($table->getName());
         $ret .= $this->getDropTableDDL($table);
         $ret .= $this->getAddTableDDL($table);
     }
     if ($ret) {
         $ret = $this->getBeginDDL() . $ret . $this->getEndDDL();
     }
     return $ret;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:13,代码来源:MysqlPlatform.php

示例3: getAddTablesDDL

 /**
  * {@inheritdoc}
  */
 public function getAddTablesDDL(Database $database)
 {
     $ret = '';
     foreach ($database->getTablesForSql() as $table) {
         $this->checkTable($table);
     }
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getCommentBlockDDL($table->getName());
         $ret .= $this->getDropTableDDL($table);
         $ret .= $this->getAddTableDDL($table);
         $ret .= $this->getAddIndicesDDL($table);
     }
     return $ret;
 }
开发者ID:a-melnichuk,项目名称:Movies-Demo,代码行数:17,代码来源:SqlitePlatform.php

示例4: getWarnings

 public function getWarnings(Database $database, PropelPlatformInterface $platform)
 {
     foreach ($database->getTablesForSql() as $table) {
         foreach ($table->getForeignKeys() as $fk) {
             if ($platform instanceof MssqlPlatform && $fk->hasOnUpdate() && $fk->getOnUpdate() == ForeignKey::SETNULL) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON UPDATE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
             if ($platform instanceof MssqlPlatform && $fk->hasOnDelete() && $fk->getOnDelete() == ForeignKey::SETNULL) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON DELETE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
             if ($platform instanceof OraclePlatform && $fk->hasOnUpdate()) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON UPDATE" option for "%s" fk on "%s" table (unsupported by current Oracle adapter).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
         }
     }
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:22,代码来源:PropelSQLTask.php

示例5: testAddArrayTable

 public function testAddArrayTable()
 {
     $database = new Database();
     $database->addTable(['name' => 'books']);
     $database->addTable(['name' => 'authors']);
     $database->addTable(['name' => 'categories', 'skipSql' => 'true']);
     $database->addTable(['name' => 'publishers', 'readOnly' => 'true']);
     $this->assertTrue($database->hasTable('books'));
     $this->assertTrue($database->hasTable('books', true));
     $this->assertFalse($database->hasTable('BOOKS'));
     $this->assertTrue($database->hasTableByPhpName('Books'));
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTable('books'));
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTableByPhpName('Books'));
     // 3 tables because read only table is excluded from the count
     $this->assertSame(3, $database->countTables());
     // 3 tables because skipped sql table is excluded from the count
     $this->assertCount(3, $database->getTablesForSql());
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:18,代码来源:DatabaseTest.php


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