Open stepanselyuk opened 7 years ago
appendLockHint used in a query parsing code, and by default (\Doctrine\DBAL\Platforms\AbstractPlatform::appendLockHint):
public function appendLockHint($fromClause, $lockMode)
{
return $fromClause;
}
Is there a reason why \FOD\DBALClickHouse\ClickHousePlatform::appendLockHint throws exception?
Hi, Stepan!
ClickHouse engine does not support locks
-- that's why ClickHousePlatform::appendLockHint()
throws Exception
.
In given query lock
is unnecessary. QueryBuilder
of ORM
layer adds it (we suggest to use DBAL
QueryBuilder
).
We tried to remove this Exception
to allow work with library from ORM
layer as well, but we got 2 other errors:
QB
added them)count()
except *
We will think how to solve this problem. You can use library without ORM
, only with DBAL
.
For count() function possible to use user-defined DQL function like this:
<?php
namespace Trim\Clickhouse\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
/**
* ROWS_COUNT(str)
* "ROWS_COUNT" "(" ")".
*/
class RowsCountFunction extends FunctionNode
{
public function getSql(SqlWalker $sqlWalker)
{
return 'COUNT(*)';
}
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER); // ROWS_COUNT
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}
But yeah, yet I didn't found a way how to remove aliases from ORM query builder. I tried just to specify alias as empty string, but got other ORM error, like expected end of string, but got other.
Hello, I tried to create a query using QueryBuilder, but got error:
The code which produces this error:
It produces DQL:
SELECT count(c) FROM Trim\Clickhouse\Model\ClickStat c WHERE c.link = :link_id
Can you suggest where there is an error?
Btw, example with the connection use is working: