Skip to content
Permalink
Browse files

Search on server: Lower-case columns after casting to text, to preven…

…t data type error: "function lower(integer) does not exist". Closes #235
  • Loading branch information...
ansgarbecker committed May 3, 2019
1 parent 32b0dfc commit fb02867059eae879c0469e01bbb62f94d5790d7e
Showing with 5 additions and 6 deletions.
  1. +5 −6 source/tabletools.pas
@@ -889,22 +889,21 @@ procedure TfrmTableTools.DoFind(DBObj: TDBObject);

end else begin
// Search case insensitive
Column := 'LOWER('+Column+')';
case DBObj.Connection.Parameters.NetTypeGroup of
ngMySQL: begin
if IsRegExp then
SQL := SQL + 'CONVERT('+Column+' USING '+DBObj.Connection.CharacterSet+') REGEXP ' + esc(FindText) + ' OR '
SQL := SQL + 'LOWER(CONVERT('+Column+' USING '+DBObj.Connection.CharacterSet+')) REGEXP ' + esc(FindText) + ' OR '
else
SQL := SQL + 'CONVERT('+Column+' USING '+DBObj.Connection.CharacterSet+') LIKE ' + esc(FindTextJokers) + ' OR ';
SQL := SQL + 'LOWER(CONVERT('+Column+' USING '+DBObj.Connection.CharacterSet+')) LIKE ' + esc(FindTextJokers) + ' OR ';
end;
ngMSSQL: begin
SQL := SQL + Column+' LIKE ' + esc(FindTextJokers) + ' OR ';
SQL := SQL + 'LOWER('+Column+') LIKE ' + esc(FindTextJokers) + ' OR ';
end;
ngPgSQL: begin
if IsRegExp then
SQL := SQL + 'CAST('+Column+' AS TEXT) SIMILAR TO ' + esc(FindTextJokers) + ' OR '
SQL := SQL + 'LOWER(CAST('+Column+' AS TEXT)) SIMILAR TO ' + esc(FindTextJokers) + ' OR '
else
SQL := SQL + 'CAST('+Column+' AS TEXT) LIKE ' + esc(FindTextJokers) + ' OR ';
SQL := SQL + 'LOWER(CAST('+Column+' AS TEXT)) LIKE ' + esc(FindTextJokers) + ' OR ';
end;
end;
end;

0 comments on commit fb02867

Please sign in to comment.
You can’t perform that action at this time.