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

Some bug when filter data by column type bit(1) #150

Open
RuslanMelnychenko opened this issue Aug 25, 2022 · 0 comments
Open

Some bug when filter data by column type bit(1) #150

RuslanMelnychenko opened this issue Aug 25, 2022 · 0 comments

Comments

@RuslanMelnychenko
Copy link
Contributor

RuslanMelnychenko commented Aug 25, 2022

When filter some data where type of column bit(1) (like true, false) and filter true then request return nothing.

$db->run("SELECT t2.`comment_id` AS `comment_id`, 
t2.`text` AS `text`, 
BIT_COUNT(t2.`public`) AS `public`, 
t2.`updated` AS `updated`, 
t2.`created` AS `created`, 
BIT_COUNT(t2.`archived`) AS `archived`
FROM `tasks_comments` AS t2
WHERE t2.`task_id` = ? AND (t2.`public` = ?)
ORDER BY t2.`comment_id` ASC", 24408, true);

But when make request without include value of filter in function, request return correct data

$db->run("SELECT t2.`comment_id` AS `comment_id`, 
t2.`text` AS `text`, 
BIT_COUNT(t2.`public`) AS `public`, 
t2.`updated` AS `updated`, 
t2.`created` AS `created`, 
BIT_COUNT(t2.`archived`) AS `archived`
FROM `tasks_comments` AS t2
WHERE t2.`task_id` = ? AND (t2.`public` = 1)
ORDER BY t2.`comment_id` ASC", 24408);

How I understand, it's bug because All values are treated as PDO::PARAM_STR.

When set filter false, it works current. But with true incorrect.
How can fix it? When need to use as argument in function?

PHP 7.4. MySQL 8.0

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

1 participant