Skip to content
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

Incorrect response on ActiveRecord->count() #7

Closed
rowdyroad opened this issue Apr 25, 2017 · 3 comments
Closed

Incorrect response on ActiveRecord->count() #7

rowdyroad opened this issue Apr 25, 2017 · 3 comments

Comments

@rowdyroad
Copy link
Contributor

rowdyroad commented Apr 25, 2017

Hi, again.

I've found this issue when working with ActiveRestController.

Index action makes count(*) query (for pagination). So, your component return an array not scalar int value.

Little Example:
class Measuring extends \yii\db\ActiveRecord
class MeasuringReport extends \kak\clickhouse\ActiveRecord

var_dump(\app\models\Measuring::find()->count()); var_dump(\app\models\MeasuringReport::find()->count());
Response is:

int(4308936)
array(1) { [0]=> array(1) { ["COUNT()"]=> string(7) "4308936" } }

Now I'm thinking about way to fix it, we can think together))

@sanchezzzhak
Copy link
Owner

Hi, yes this is error (
I don't use ActiveRecord, just DAO, but interested to fix it up

sanchezzzhak added a commit that referenced this issue Apr 25, 2017
#7: add queryColumn and queryScalar method to Command;
@sanchezzzhak
Copy link
Owner

Tnx

@rowdyroad
Copy link
Contributor Author

без проблем ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants