This may cause unnecessary backslashes (in the case of a literal
% or _) to end up in the query when the DBMS uses C-style string
escaping; however, the query should still work.
Change-Id: I82681f83dd45fcbecf4bfd672f550cd4dba30949
* @return string
*/
protected function escapeLikeInternal( $s ) {
- $s = str_replace( '\\', '\\\\', $s );
- $s = $this->strencode( $s );
- $s = str_replace( array( '%', '_' ), array( '\%', '\_' ), $s );
-
- return $s;
+ return addcslashes( $s, '\%_' );
}
/**
}
}
- return " LIKE '" . $s . "' ";
+ return " LIKE {$this->addQuotes( $s )} ";
}
/**