-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add totals #24
base: master
Are you sure you want to change the base?
add totals #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "totals" may be not needed at results. It must be manipulated by input parameter. An extra data like additional "totals" entry can destroy existing applications.
I thought about it, but I have no idea how not to break existing applications and add total output And it should not break anything, unless someone uses a query with "WITH TOTALS", but why use it if it cannot be displayed? |
I added getTotals() method for the replaced vendor's class for it in my application:
|
how i can use this in controller or template or pager ? |
Here is using in my Symfony service:
I do not use database access in controllers or templates. |
okay |
updates from base repository
My solution: /**@var \FOD\DBALClickHouse\Connection $conn */
$olapConnection = $this->_doctrine_manager->getConnection('clickhouse');
$clickHouseConnection = $olapConnection->getWrappedConnection();
$class = new \ReflectionClass($clickHouseConnection);
$property = $class->getProperty('smi2CHClient');
$property->setAccessible(true);
/** @var \ClickHouseDB\Client $client */
$client = $property->getValue($clickHouseConnection);
$params = ['field3' => 'value'];
$statement = $client->select('SELECT field1, COUNT(*) AS field2 FROM table1 WHERE field3 = :field3 GROUP BY field1 LIMIT 5, 10', $params);
$statement->rows(); // get rows by LIMIT
$statement->countAll(); // Count all rows (like LIMIT not using) - for implementation my pagination Details in the documentation https://github.com/smi2/phpClickHouse#start |
No description provided.