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

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

merged 2 commits into from
Feb 4, 2017

Conversation

alikon
Copy link
Contributor

@alikon alikon commented Oct 8, 2016

fix for standard SQL

Summary of Changes

A timestamp/datetime field CANNOT be used with LIKE operator we need to cast to char before in standard SQL

Testing Instructions

Smart Search: Indexed Content search field with a date work as before

…stamp field

A timestamp/datetime field CANNOT be used with LIKE we need to cast to char before in standard SQL
@@ -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

used $query->castAsChar()
@alikon
Copy link
Contributor Author

alikon commented Oct 15, 2016

used $query->castAsChar() as requested

@alikon
Copy link
Contributor Author

alikon commented Oct 15, 2016

@mbabker i've done something for the CAST implementation can you review #12417 ?

@ghost
Copy link

ghost commented Jan 12, 2017

@alikon ist this PR for testing or waiting on Answer?

@alikon
Copy link
Contributor Author

alikon commented Jan 12, 2017 via email

@ghost
Copy link

ghost commented Jan 12, 2017

Searched for "12. 3. 1991" as Part of an Article-Titel in Backend, which is found with and without Patch.
Searched for same at Frontend which is not found with and without Patch.

@alikon
Copy link
Contributor Author

alikon commented Jan 12, 2017

@franz-wohlkoenig this PR is only for backend

@ghost
Copy link

ghost commented Jan 12, 2017

I have tested this item ✅ successfully on 98cf619

Searched for "12. 3. 1991" as Part of an Article-Titel in Backend, which is found with and without Patch.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12348.

@csthomas
Copy link
Contributor

csthomas commented Feb 2, 2017

I have tested this item ✅ successfully on 98cf619


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12348.

@zero-24 zero-24 added this to the Joomla 3.7.0 milestone Feb 3, 2017
@zero-24 zero-24 added the RTC This Pull Request is Ready To Commit label Feb 3, 2017
@wilsonge wilsonge merged commit df959ba into joomla:staging Feb 4, 2017
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 4, 2017
@alikon alikon deleted the patch-83 branch February 5, 2017 05:40
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

Successfully merging this pull request may close these issues.

None yet

6 participants