mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Slightly enhance open SQL file mechanism:
- Open the file in "read and leave" mode, don't lock it for write operations. This fixes opening a file which is opened and write locked in another application - Handle exceptions for ReadTextfile in QueryLoad which was malfunctioning yet, lead to an AV. - Enhance inline documentation
This commit is contained in:
@ -2339,7 +2339,7 @@ end;
|
||||
}
|
||||
procedure OpenTextFile(const Filename: String; out Stream: TFileStream; out FileCharset: TFileCharset);
|
||||
begin
|
||||
Stream := TFileStream.Create(Filename, fmOpenRead or fmShareDenyWrite);
|
||||
Stream := TFileStream.Create(Filename, fmOpenRead or fmShareDenyNone);
|
||||
Stream.Position := 0;
|
||||
FileCharset := GetFileCharset(Stream);
|
||||
end;
|
||||
@ -2545,12 +2545,9 @@ var
|
||||
Stream: TFileStream;
|
||||
FileCharset: TFileCharset;
|
||||
begin
|
||||
try
|
||||
OpenTextfile(Filename, Stream, FileCharset);
|
||||
Result := ReadTextfileChunk(Stream, FileCharset);
|
||||
finally
|
||||
Stream.Free;
|
||||
end;
|
||||
OpenTextfile(Filename, Stream, FileCharset);
|
||||
Result := ReadTextfileChunk(Stream, FileCharset);
|
||||
Stream.Free;
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user