本文整理汇总了PHP中OCP\IDBConnection::tableExists方法的典型用法代码示例。如果您正苦于以下问题:PHP IDBConnection::tableExists方法的具体用法?PHP IDBConnection::tableExists怎么用?PHP IDBConnection::tableExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IDBConnection
的用法示例。
在下文中一共展示了IDBConnection::tableExists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertTableNotExist
/**
* @param string $table
*/
public function assertTableNotExist($table) {
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
// sqlite removes the tables after closing the DB
$this->assertTrue(true);
} else {
$this->assertFalse($this->connection->tableExists($table), 'Table ' . $table . ' doesnt exists.');
}
}
示例2: testRun
public function testRun()
{
$this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist before repairing');
$this->assertTrue($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does exist before repairing');
$repair = new \OC\Repair\DropOldTables($this->connection);
$repair->run();
$this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist after repairing');
$this->assertFalse($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does not exist after repairing');
}
示例3: run
/**
* Run repair step.
* Must throw exception on error.
*
* @throws \Exception in case of failure
*/
public function run()
{
foreach ($this->oldDatabaseTables() as $tableName) {
if ($this->connection->tableExists($tableName)) {
$this->emit('\\OC\\Repair', 'info', [sprintf('Table %s has been deleted', $tableName)]);
$this->connection->dropTable($tableName);
}
}
}
示例4: testRun
public function testRun()
{
$this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist before repairing');
$this->assertTrue($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does exist before repairing');
/** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
$outputMock = $this->getMockBuilder('\\OCP\\Migration\\IOutput')->disableOriginalConstructor()->getMock();
$repair = new \OC\Repair\DropOldTables($this->connection);
$repair->run($outputMock);
$this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist after repairing');
$this->assertFalse($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does not exist after repairing');
}
示例5: run
/**
* Run repair step.
* Must throw exception on error.
*
* @throws \Exception in case of failure
*/
public function run(IOutput $output)
{
$tables = $this->oldDatabaseTables();
$output->startProgress(count($tables));
foreach ($this->oldDatabaseTables() as $tableName) {
if ($this->connection->tableExists($tableName)) {
$this->connection->dropTable($tableName);
}
$output->advance(1, "Drop old database table: {$tableName}");
}
$output->finishProgress();
}
示例6: __destruct
public function __destruct()
{
try {
$this->cleanEmptyLocks();
} catch (\PDOException $e) {
// If the table is missing, the clean up was successful
if ($this->connection->tableExists('file_locks')) {
throw $e;
}
}
}
示例7: cleanExpiredLocks
/**
* cleanup empty locks
*/
public function cleanExpiredLocks()
{
$expire = $this->timeFactory->getTime();
try {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*file_locks` WHERE `ttl` < ?', [$expire]);
} catch (\Exception $e) {
// If the table is missing, the clean up was successful
if ($this->connection->tableExists('file_locks')) {
throw $e;
}
}
}
示例8: tableExists
/**
* Check if a table exists
*
* @param string $table table name without the prefix
* @return bool
*/
public function tableExists($table)
{
return $this->connection->tableExists($table);
}
示例9: setup
public function setup()
{
if (!$this->dbConnection->tableExists($this->sourceCalendarTable)) {
throw new \DomainException('Calendar tables are missing. Nothing to do.');
}
}