Skip to content

Commit

Permalink
Use prefix Abstract in abstract class querybuilder. (#148)
Browse files Browse the repository at this point in the history
* Use prefix Abstract in abstract class querybuilder.
  • Loading branch information
terabytesoftw committed Jan 6, 2023
1 parent ad151a2 commit cea9688
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/CommandPDO.php
Expand Up @@ -10,7 +10,6 @@
use Yiisoft\Db\Driver\PDO\AbstractCommandPDO;
use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
use Yiisoft\Db\Exception\ConvertException;
use Yiisoft\Db\QueryBuilder\QueryBuilder;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\Schema;

Expand Down
2 changes: 1 addition & 1 deletion src/DDLQueryBuilder.php
Expand Up @@ -6,7 +6,7 @@

use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\QueryBuilder\DDLQueryBuilder as AbstractDDLQueryBuilder;
use Yiisoft\Db\QueryBuilder\AbstractDDLQueryBuilder;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\ColumnSchemaBuilder;
use Yiisoft\Db\Schema\QuoterInterface;
Expand Down
23 changes: 19 additions & 4 deletions src/DMLQueryBuilder.php
Expand Up @@ -12,9 +12,9 @@
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\Expression;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\DMLQueryBuilder as AbstractDMLQueryBuilder;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\AbstractDMLQueryBuilder;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\QuoterInterface;
use Yiisoft\Db\Schema\SchemaInterface;

Expand Down Expand Up @@ -84,10 +84,25 @@ public function batchInsert(string $table, array $columns, iterable|Generator $r
return 'INSERT ALL ' . $tableAndColumns . implode($tableAndColumns, $values) . ' SELECT 1 FROM SYS.DUAL';
}

/**
* @throws Exception
* @throws InvalidArgumentException
* @throws InvalidConfigException
* @throws NotSupportedException
*/
public function insertWithReturningPks(string $table, QueryInterface|array $columns, array &$params = []): string
{
throw new NotSupportedException(__METHOD__ . ' is not supported by Oracle.');
}

/**
* @link https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm#SQLRF01606
*
* @throws Exception|InvalidArgumentException|InvalidConfigException|JsonException|NotSupportedException
* @throws Exception
* @throws InvalidArgumentException
* @throws InvalidConfigException
* @throws JsonException
* @throws NotSupportedException
*/
public function upsert(
string $table,
Expand Down Expand Up @@ -205,7 +220,7 @@ protected function prepareInsertValues(string $table, array|QueryInterface $colu
$columns = !empty($tableSchema->getPrimaryKey())
? $tableSchema->getPrimaryKey() : [reset($tableColumns)->getName()];
foreach ($columns as $name) {
/** @var mixed */
/** @psalm-var mixed */
$names[] = $this->quoter->quoteColumnName($name);
$placeholders[] = 'DEFAULT';
}
Expand Down
13 changes: 8 additions & 5 deletions src/DQLQueryBuilder.php
Expand Up @@ -6,9 +6,9 @@

use Yiisoft\Db\Oracle\Builder\InConditionBuilder;
use Yiisoft\Db\Oracle\Builder\LikeConditionBuilder;
use Yiisoft\Db\QueryBuilder\AbstractDQLQueryBuilder;
use Yiisoft\Db\QueryBuilder\Condition\InCondition;
use Yiisoft\Db\QueryBuilder\Condition\LikeCondition;
use Yiisoft\Db\QueryBuilder\DQLQueryBuilder as AbstractDQLQueryBuilder;

use function array_merge;
use function implode;
Expand Down Expand Up @@ -51,9 +51,12 @@ public function selectExists(string $rawSql): string

protected function defaultExpressionBuilders(): array
{
return array_merge(parent::defaultExpressionBuilders(), [
InCondition::class => InConditionBuilder::class,
LikeCondition::class => LikeConditionBuilder::class,
]);
return array_merge(
parent::defaultExpressionBuilders(),
[
InCondition::class => InConditionBuilder::class,
LikeCondition::class => LikeConditionBuilder::class,
],
);
}
}
2 changes: 1 addition & 1 deletion src/QueryBuilder.php
Expand Up @@ -4,7 +4,7 @@

namespace Yiisoft\Db\Oracle;

use Yiisoft\Db\QueryBuilder\QueryBuilder as AbstractQueryBuilder;
use Yiisoft\Db\QueryBuilder\AbstractQueryBuilder;
use Yiisoft\Db\Schema\QuoterInterface;
use Yiisoft\Db\Schema\Schema;
use Yiisoft\Db\Schema\SchemaInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/QueryBuilderTest.php
Expand Up @@ -405,7 +405,7 @@ public function testInsertWithReturningPks(
): void {
$this->expectException(NotSupportedException::class);
$this->expectExceptionMessage(
'Yiisoft\Db\QueryBuilder\DMLQueryBuilder::insertWithReturningPks() is not supported by this DBMS.',
'Yiisoft\Db\Oracle\DMLQueryBuilder::insertWithReturningPks is not supported by Oracle.',
);

$db = $this->getConnection(true);
Expand Down

0 comments on commit cea9688

Please sign in to comment.