mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Make search on server more compatible to MSSQL: Remove LOWER() call, which fails on TEXT fields and is not even required. And add an equivalent to MySQL's BINARY search. See http://www.heidisql.com/forum.php?t=14950
This commit is contained in:
@ -749,14 +749,19 @@ begin
|
||||
SQL := '';
|
||||
for Col in Columns do begin
|
||||
if (comboDatatypes.ItemIndex = 0) or (Integer(Col.DataType.Category) = comboDatatypes.ItemIndex-1) then begin
|
||||
if chkCaseSensitive.Checked then
|
||||
SQL := SQL + DBObj.Connection.QuoteIdent(Col.Name) + ' LIKE BINARY ' + esc('%'+memoFindText.Text+'%') + ' OR '
|
||||
else begin
|
||||
if chkCaseSensitive.Checked then begin
|
||||
case DBObj.Connection.Parameters.NetTypeGroup of
|
||||
ngMySQL:
|
||||
SQL := SQL + DBObj.Connection.QuoteIdent(Col.Name) + ' LIKE BINARY ' + esc('%'+memoFindText.Text+'%') + ' OR ';
|
||||
ngMSSQL:
|
||||
SQL := SQL + DBObj.Connection.QuoteIdent(Col.Name)+' LIKE ' + esc('%'+LowerCase(memoFindText.Text)+'%') + ' COLLATE SQL_Latin1_General_CP1_CS_AS OR ';
|
||||
end;
|
||||
end else begin
|
||||
case DBObj.Connection.Parameters.NetTypeGroup of
|
||||
ngMySQL:
|
||||
SQL := SQL + 'LOWER(CONVERT('+DBObj.Connection.QuoteIdent(Col.Name)+' USING '+DBObj.Connection.CharacterSet+')) LIKE ' + esc('%'+LowerCase(memoFindText.Text)+'%') + ' OR ';
|
||||
ngMSSQL:
|
||||
SQL := SQL + 'LOWER('+DBObj.Connection.QuoteIdent(Col.Name)+') LIKE ' + esc('%'+LowerCase(memoFindText.Text)+'%') + ' OR ';
|
||||
SQL := SQL + DBObj.Connection.QuoteIdent(Col.Name)+' LIKE ' + esc('%'+LowerCase(memoFindText.Text)+'%') + ' OR ';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user