Skip to content

Commit 02cf4cb

Browse files
committed
fix: allow non existent SQLite files, only complain when its *path* does not exist
Refs #2437
1 parent e940863 commit 02cf4cb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

extra/locale/heidisql.po

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: HeidiSQL\n"
99
"POT-Creation-Date: 2012-11-05 21:40\n"
10-
"PO-Revision-Date: 2026-03-20 10:10+0100\n"
10+
"PO-Revision-Date: 2026-03-20 15:16+0100\n"
1111
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
1212
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
1313
"Language: en\n"
@@ -6809,3 +6809,9 @@ msgstr "Show reverse foreign keys"
68096809

68106810
msgid "Login cancelled"
68116811
msgstr "Login cancelled"
6812+
6813+
msgid "Folder in path does not exist: %s"
6814+
msgstr "Folder in path does not exist: %s"
6815+
6816+
msgid "File does not yet exist, will be created now: %s"
6817+
msgstr "File does not yet exist, will be created now: %s"

source/dbconnection.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,7 @@ procedure TSQLiteConnection.SetActive(Value: Boolean);
28562856
ErrorHint: String;
28572857
FileNames, EncryptionParams: TStringList;
28582858
MainFile, DbAlias, Param, ParamName: String;
2859+
MainFileDir: String;
28592860
i, SplitPos, ParamValue: Integer;
28602861
CipherIndex, ConfigResult: Integer;
28612862
ParamWasSet: Boolean;
@@ -2866,8 +2867,12 @@ procedure TSQLiteConnection.SetActive(Value: Boolean);
28662867

28672868
if Value then begin
28682869
// Fixes "out of memory" crash in sqlite3_open, see issue #1367
2870+
MainFileDir := ExtractFilePath(MainFile);
2871+
MainFileDir := IncludeTrailingPathDelimiter(MainFileDir);
2872+
if not DirectoryExists(MainFileDir) then
2873+
raise EDbError.Create(f_('Folder in path does not exist: %s', [MainFile]));
28692874
if not FileExists(MainFile) then
2870-
raise EDbError.Create(f_('File does not exist: %s', [MainFile]));
2875+
Log(lcInfo, f_('File does not yet exist, will be created now: %s', [MainFile]));
28712876

28722877
DoBeforeConnect;
28732878

0 commit comments

Comments
 (0)