本文整理匯總了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;
}
示例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;
}
示例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]);
}
示例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]);
}