mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Kill all users of StrUtils.
This commit is contained in:
@ -10,7 +10,7 @@ interface
|
|||||||
|
|
||||||
uses Classes, SysUtils, Graphics, db, clipbrd, dialogs,
|
uses Classes, SysUtils, Graphics, db, clipbrd, dialogs,
|
||||||
forms, controls, ShellApi, checklst, windows, ZDataset, ZAbstractDataset,
|
forms, controls, ShellApi, checklst, windows, ZDataset, ZAbstractDataset,
|
||||||
shlobj, ActiveX, StrUtils, WideStrUtils, VirtualTrees, SynRegExpr, Messages, WideStrings;
|
shlobj, ActiveX, WideStrUtils, VirtualTrees, SynRegExpr, Messages, WideStrings;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ type
|
|||||||
function getFirstWord( text: String ): String;
|
function getFirstWord( text: String ): String;
|
||||||
function ConvertWindowsCodepageToMysqlCharacterSet(codepage: Cardinal): string;
|
function ConvertWindowsCodepageToMysqlCharacterSet(codepage: Cardinal): string;
|
||||||
function GetFieldValue( Field: TField ): String;
|
function GetFieldValue( Field: TField ): String;
|
||||||
function LastPos( substr: WideString; str: WideString): Integer;
|
function LastPos(needle: WideChar; haystack: WideString): Integer;
|
||||||
function ConvertServerVersion( Version: Integer ): String;
|
function ConvertServerVersion( Version: Integer ): String;
|
||||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
||||||
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
|
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
|
||||||
@ -2021,12 +2021,19 @@ end;
|
|||||||
@param string Text
|
@param string Text
|
||||||
@return Integer Last position
|
@return Integer Last position
|
||||||
}
|
}
|
||||||
function LastPos( substr: WideString; str: WideString): Integer;
|
function LastPos(needle: WideChar; haystack: WideString): Integer;
|
||||||
|
var
|
||||||
|
reverse: WideString;
|
||||||
|
i, len, w: Integer;
|
||||||
begin
|
begin
|
||||||
|
// Reverse string.
|
||||||
|
len := Length(haystack);
|
||||||
|
SetLength(reverse, len);
|
||||||
|
for i := 1 to len do reverse[i] := haystack[len - i + 1];
|
||||||
|
// Look for needle.
|
||||||
Result := 0;
|
Result := 0;
|
||||||
str := ReverseString( str );
|
w := Pos(needle, reverse);
|
||||||
if Pos( substr, str ) > 0 then
|
if w > 0 then Result := len - w + 1;
|
||||||
Result := Length(str) - Pos( substr, str ) + 1;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ uses
|
|||||||
ActnList, ImgList, Registry, ShellApi, ToolWin, Clipbrd, db, DBCtrls,
|
ActnList, ImgList, Registry, ShellApi, ToolWin, Clipbrd, db, DBCtrls,
|
||||||
SynMemo, synedit, SynEditTypes, ZDataSet, ZSqlProcessor,
|
SynMemo, synedit, SynEditTypes, ZDataSet, ZSqlProcessor,
|
||||||
HeidiComp, sqlhelp, MysqlQueryThread, Childwin, VirtualTrees, TntDBGrids,
|
HeidiComp, sqlhelp, MysqlQueryThread, Childwin, VirtualTrees, TntDBGrids,
|
||||||
StrUtils, DateUtils, PngImageList, OptimizeTables, View, Usermanager,
|
DateUtils, PngImageList, OptimizeTables, View, Usermanager,
|
||||||
SelectDBObject;
|
SelectDBObject;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -1248,30 +1248,30 @@ begin
|
|||||||
paramValue := '';
|
paramValue := '';
|
||||||
param := ParamStr(curIdx);
|
param := ParamStr(curIdx);
|
||||||
// Example: --user=root --session="My session name" --password
|
// Example: --user=root --session="My session name" --password
|
||||||
if AnsiStartsStr('--'+paramName, param) then
|
if Pos('--' + paramName, param) = 1 then
|
||||||
begin
|
begin
|
||||||
i := Length('--'+paramName) + 1;
|
i := Length('--' + paramName) + 1;
|
||||||
if param[i] = '=' then
|
if param[i] = '=' then
|
||||||
paramValue := MidStr(param, i+1, Length(param)+1);
|
paramValue := Copy(param, i + 1, Length(param) - i);
|
||||||
if (AnsiLeftStr(paramValue, 1) = '"') and (AnsiRightStr(paramValue, 1) = '"') then
|
if (Copy(paramValue, 1, 1) = '"') and (Copy(paramValue, Length(paramValue), 1) = '"') then
|
||||||
paramValue := MidStr(paramValue, 2, Length(paramValue));
|
paramValue := Copy(paramValue, 2, Length(paramValue) - 2);
|
||||||
result := True;
|
result := True;
|
||||||
|
|
||||||
end else if AnsiStartsStr('-'+paramChar, param) then
|
end else if Pos('-' + paramChar, param) = 1 then
|
||||||
begin
|
begin
|
||||||
if Length(param) > 2 then
|
if Length(param) > 2 then
|
||||||
begin
|
begin
|
||||||
// Example: -uroot -s"My session name"
|
// Example: -uroot -s"My session name"
|
||||||
paramValue := MidStr(param, 3, Length(param)+1);
|
paramValue := Copy(param, 3, Length(param) - 2);
|
||||||
if (AnsiLeftStr(paramValue, 1) = '"') and (AnsiRightStr(paramValue, 1) = '"') then
|
if (Copy(paramValue, 1, 1) = '"') and (Copy(paramValue, Length(paramValue), 1) = '"') then
|
||||||
paramValue := MidStr(paramValue, 2, Length(paramValue));
|
paramValue := Copy(paramValue, 2, Length(paramValue) - 2);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
// Example: -u root -s "My session name" -p
|
// Example: -u root -s "My session name" -p
|
||||||
nextIdx := curIdx + 1;
|
nextIdx := curIdx + 1;
|
||||||
if nextIdx <= ParamCount then begin
|
if nextIdx <= ParamCount then begin
|
||||||
nextParam := ParamStr(nextIdx);
|
nextParam := ParamStr(nextIdx);
|
||||||
if not AnsiStartsStr('-', nextParam) then
|
if not Pos('-', nextParam) = 1 then
|
||||||
paramValue := nextParam;
|
paramValue := nextParam;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user