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


PHP Table::dropSql方法代碼示例

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


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

示例1: drop

 /**
  * {@inheritDoc}
  */
 public function drop(ConnectionInterface $db)
 {
     if (empty($this->_schema)) {
         return false;
     }
     try {
         $sql = $this->_schema->dropSql($db);
         foreach ($sql as $stmt) {
             $db->execute($stmt)->closeCursor();
         }
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
開發者ID:taodf,項目名稱:cakephp,代碼行數:18,代碼來源:TestFixture.php

示例2: drop

 /**
  * Run after all tests executed, should return SQL statement to drop table for this fixture.
  *
  * @param Connection $db An instance of the database object used to create the fixture table
  * @return bool True on success, false on failure
  */
 public function drop(Connection $db)
 {
     if (empty($this->_schema)) {
         return false;
     }
     try {
         $sql = $this->_schema->dropSql($db);
         foreach ($sql as $stmt) {
             $db->execute($stmt)->closeCursor();
         }
         $this->created = array_diff($this->created, [$db->configName()]);
     } catch (\Exception $e) {
         return false;
     }
     return true;
 }
開發者ID:ripzappa0924,項目名稱:carte0.0.1,代碼行數:22,代碼來源:TestFixture.php

示例3: testDropSql

 /**
  * test dropSql
  *
  * @return void
  */
 public function testDropSql()
 {
     $driver = $this->_getMockedDriver();
     $connection = $this->getMockBuilder('Cake\\Database\\Connection')->disableOriginalConstructor()->getMock();
     $connection->expects($this->any())->method('driver')->will($this->returnValue($driver));
     $table = new Table('schema_articles');
     $result = $table->dropSql($connection);
     $this->assertCount(1, $result);
     $this->assertEquals('DROP TABLE "schema_articles" CASCADE', $result[0]);
 }
開發者ID:rashmi,項目名稱:newrepo,代碼行數:15,代碼來源:PostgresSchemaTest.php

示例4: testDropSql

 /**
  * test dropSql
  *
  * @return void
  */
 public function testDropSql()
 {
     $driver = $this->_getMockedDriver();
     $connection = $this->getMock('Cake\\Database\\Connection', [], [], '', false);
     $connection->expects($this->any())->method('driver')->will($this->returnValue($driver));
     $table = new Table('articles');
     $result = $table->dropSql($connection);
     $this->assertCount(1, $result);
     $this->assertEquals('DROP TABLE "articles"', $result[0]);
 }
開發者ID:maitrepylos,項目名稱:nazeweb,代碼行數:15,代碼來源:SqliteSchemaTest.php


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