/** * After querying, make sure no temporary database tables are left. * @todo I might be better to keep the tables and possibly reuse them later * on. Being temporary, the tables will vanish with the session anyway. */ public function cleanUp() { if ($this->queryMode === Query::MODE_DEBUG) { return; } foreach ($this->executedQueries as $table => $log) { $this->connection->query("DROP TEMPORARY TABLE " . $this->connection->tableName($table), __METHOD__); } }
/** * @dataProvider dbTypeProvider */ public function testTableNameMethod($type) { $database = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('tableName', 'getType'))->getMockForAbstractClass(); $database->expects($this->any())->method('tableName')->with($this->equalTo('Foo'))->will($this->returnValue('Foo')); $database->expects($this->once())->method('getType')->will($this->returnValue($type)); $connectionProvider = $this->getMockBuilder('\\SMW\\DBConnectionProvider')->disableOriginalConstructor()->getMock(); $connectionProvider->expects($this->atLeastOnce())->method('getConnection')->will($this->returnValue($database)); $instance = new Database($connectionProvider); $instance->setDBPrefix('bar_'); $expected = $type === 'sqlite' ? 'bar_Foo' : 'Foo'; $this->assertEquals($expected, $instance->tableName('Foo')); }
/** * @since 2.3 * * @param string $table * @param integer $depth */ public function setClassHierarchyTableDefinition($table, $depth) { $this->hierarchyTypeTable['class'] = array($this->connection->tableName($table), $depth); }
/** * After querying, make sure no temporary database tables are left. * @todo I might be better to keep the tables and possibly reuse them later * on. Being temporary, the tables will vanish with the session anyway. */ public function cleanUp() { foreach ($this->executedQueries as $table => $log) { $this->connection->query("DROP TEMPORARY TABLE " . $this->connection->tableName($table), __METHOD__); } }
/** * After querying, make sure no temporary database tables are left. * @todo I might be better to keep the tables and possibly reuse them later * on. Being temporary, the tables will vanish with the session anyway. */ public function cleanUp() { foreach ($this->executedQueries as $table => $log) { $this->temporaryTableBuilder->drop($this->connection->tableName($table)); } }