本文整理汇总了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]);
}