function getReplacePreview($columnIndex, $find, $replaceWith, $useRegex, $charSet)
{
$column = $this->_columnNames[$columnIndex];
if ($useRegex) {
$result = $this->_getRegexReplaceRows($columnIndex, $find, $replaceWith, $charSet);
} else {
$sql_query = "SELECT " . Util::backquote($column) . "," . " REPLACE(" . Util::backquote($column) . ", '" . $find . "', '" . $replaceWith . "')," . " COUNT(*)" . " FROM " . Util::backquote($this->db) . "." . Util::backquote($this->table) . " WHERE " . Util::backquote($column) . " LIKE '%" . $find . "%' COLLATE " . $charSet . "_bin";
// here we
// change the collation of the 2nd operand to a case sensitive
// binary collation to make sure that the comparison
// is case sensitive
$sql_query .= " GROUP BY " . Util::backquote($column) . " ORDER BY " . Util::backquote($column) . " ASC";
$result = $this->dbi->fetchResult($sql_query, 0);
}
return Template::get('table/search/replace_preview')->render(array('db' => $this->db, 'table' => $this->table, 'columnIndex' => $columnIndex, 'find' => $find, 'replaceWith' => $replaceWith, 'useRegex' => $useRegex, 'result' => $result));
}