Browse Source

Corrected SQL syntax so that functions are not incorrectly interpreted as table names. Fixes #28.

master
Tom Lingham 9 years ago
parent
commit
5ffe20902f
  1. 2
      src/Matchers/ConsecutiveCharactersMatcher.php
  2. 4
      src/Matchers/TimesInStringMatcher.php

2
src/Matchers/ConsecutiveCharactersMatcher.php

@ -39,6 +39,6 @@ class ConsecutiveCharactersMatcher extends BaseMatcher
{
$searchString = $this->formatSearchString($rawString);
return "IF(REPLACE($column, '\.', '') {$this->operator} '$searchString', ROUND({$this->multiplier} * (CHAR_LENGTH( '$rawString' ) / CHAR_LENGTH( REPLACE($column, ' ', '') ))), 0)";
return "IF( REPLACE($column, '\.', '') {$this->operator} '$searchString', ROUND({$this->multiplier} * ( CHAR_LENGTH( '$rawString' ) / CHAR_LENGTH( REPLACE($column, ' ', '') ))), 0)";
}
}

4
src/Matchers/TimesInStringMatcher.php

@ -20,8 +20,8 @@ class TimesInStringMatcher extends BaseMatcher
*/
public function buildQueryString($column, $searchString)
{
$query = "{$this->multiplier} * ROUND ((
CHAR_LENGTH($column) - CHAR_LENGTH( REPLACE ( LOWER($column), lower('$searchString'), ''))
$query = "{$this->multiplier} * ROUND((
CHAR_LENGTH($column) - CHAR_LENGTH( REPLACE( LOWER($column), lower('$searchString'), ''))
) / LENGTH('$searchString'))";
return $query;

Loading…
Cancel
Save