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

[com_finder] - cast to char before use LIKE operator on datetime/tim… #12348

Merged
merged 2 commits into from
Feb 4, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion administrator/components/com_finder/models/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected function getListQuery()
// Filter by indexdate only if $search doesn't contains non-ascii characters
if (!preg_match('/[^\x00-\x7F]/', $search))
{
$orSearchSql .= ' OR ' . $db->quoteName('l.indexdate') . ' LIKE ' . $search;
$orSearchSql .= ' OR CAST((' . $db->quoteName('l.indexdate') . ') AS CHAR(19)) LIKE ' . $search;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $query->castAsChar() please. I've also looked and realized we don't have a proper implementation of that for the MySQL drivers (the default implementation just returns the value).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've noticed that too, matter for another PR

}

$query->where('(' . $orSearchSql . ')');
Expand Down