mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 01:56:36 +08:00
* Implement Pos2, which takes a start parameter.
* Mask USING {BTREE,HASH,RTREE} from older servers. I wonder why mysqld doesn't do this by itself. Fixes issue #1779065.
This commit is contained in:
@ -421,6 +421,7 @@ procedure TExportSQLForm.btnExportClick(Sender: TObject);
|
||||
var
|
||||
f : TFileStream;
|
||||
i,j,k,m : Integer;
|
||||
spos, epos : Integer;
|
||||
exportdb,exporttables : boolean;
|
||||
exportdata : boolean;
|
||||
dropquery,createquery,insertquery,
|
||||
@ -716,6 +717,16 @@ begin
|
||||
Insert('/*!40100 ', sql, Pos('DEFAULT CHARSET', sql));
|
||||
sql := sql + '*/';
|
||||
end;
|
||||
// Mask USING {BTREE,HASH,RTREE} from older servers.
|
||||
spos := 1;
|
||||
while true do begin
|
||||
spos := Pos2('USING', sql, spos);
|
||||
if spos = 0 then break;
|
||||
epos := min(Pos2(',', sql, spos), Pos2(')', sql, spos));
|
||||
Insert('*/', sql, epos);
|
||||
Insert('/*!50100 ', sql, spos);
|
||||
spos := epos + 11;
|
||||
end;
|
||||
if target_version = SQL_VERSION_ANSI then
|
||||
begin
|
||||
sql := StringReplace(sql, '`', '"', [rfReplaceAll]);
|
||||
|
@ -85,6 +85,7 @@ type
|
||||
function FormatTimeNumber( Seconds: Cardinal ): String;
|
||||
function TColorToHex( Color : TColor ): string;
|
||||
function GetVTCaptions( VT: TVirtualStringTree; OnlySelected: Boolean = False; Column: Integer = 0 ): TStringList;
|
||||
function Pos2(const Needle, HayStack: string; const StartPos: Integer) : Integer;
|
||||
|
||||
var
|
||||
MYSQL_KEYWORDS : TStringList;
|
||||
@ -2025,6 +2026,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function Pos2(const Needle, HayStack: string; const StartPos: Integer) : Integer;
|
||||
var
|
||||
NewHayStack: string;
|
||||
begin
|
||||
NewHayStack := Copy(HayStack, StartPos, Length(HayStack));
|
||||
Result := Pos(Needle, NewHayStack);
|
||||
if Result > 0 then Result := Result + StartPos - 1;
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user