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

Escape Wildcard Characters in get_filtering() method #135

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

briansulzen
Copy link

Search values that contain '%' or '_' will not return results. From Code Igniter guides:

The escape_like_str() method uses ‘!’ (exclamation mark) to escape special characters for LIKE conditions. Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically add the ESCAPE '!' condition for you, and so you’ll have to manually do that.

change

$sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' OR ";

to:

$sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' ESCAPE '!' OR ";

and

$sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' OR ";

to:

$sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' ESCAPE '!' OR ";

First pass of cleaning up the code and make it more readable.
Renamed a bunch of variables to reflect the CI-nomenclature.

Replaced numeric array-keys with more meaningful ones to make everybodies life easier.
This basically just adds some fixes for various issues:

IgnitedDatatables#84

IgnitedDatatables#78

IgnitedDatatables#66
Added caching to check_cType to improve performance a bit.

Cleaned a few things up.
A first take on fixing the memory-leak/performance-issue when huge result-sets are queried.
Changed the way recordsTota) and recordsFiltered are calculated.
Yeah, formatting was borked due to Githubs way of using Markdown.
Modified the way get_total_results() decides which fields to use in SELECT
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.

2 participants