Fix column size to work with Oracle. Add unit tests

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos
2022-01-11 13:31:32 -03:00
parent 425b5cf081
commit b6d9e0542d

View File

@@ -28,6 +28,7 @@ use OC\DB\QueryBuilder\Literal;
use OC\DB\QueryBuilder\Parameter;
use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use OCP\ILogger;
@@ -506,7 +507,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
public function dataFrom() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$qb = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
[$qb->createFunction('(' . $qb->select('*')->from('test')->getSQL() . ')'), 'q', null, null, [
['table' => '(SELECT * FROM `*PREFIX*test`)', 'alias' => '`q`']
], '(SELECT * FROM `*PREFIX*test`) `q`'],
['data', null, null, null, [['table' => '`*PREFIX*data`', 'alias' => null]], '`*PREFIX*data`'],
['data', 't', null, null, [['table' => '`*PREFIX*data`', 'alias' => '`t`']], '`*PREFIX*data` `t`'],
['data1', null, 'data2', null, [
@@ -523,9 +530,9 @@ class QueryBuilderTest extends \Test\TestCase {
/**
* @dataProvider dataFrom
*
* @param string $table1Name
* @param string|IQueryFunction $table1Name
* @param string $table1Alias
* @param string $table2Name
* @param string|IQueryFunction $table2Name
* @param string $table2Alias
* @param array $expectedQueryPart
* @param string $expectedQuery