FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

Ability to open local files through non-physical paths [CORE3160] #3536

Open firebird-automations opened 13 years ago

firebird-automations commented 13 years ago

Submitted by: nandod (nandod)

Firebird on Windows can't open local database files through non-physical paths, such as those created by the ancient but still supported SUBST utility:

SUBST S: C:\DB

I have been putting filters in my applications that silently convert the path to a physical one (a simple matter of calling QueryDosDevice()), but it would be good if Firebird supported this out-of-the-box.

For completeness, here's the code I use (Delphi):

function MakePhysicalPath(const APath: string): string; var LDriveLetter: string; LNewPath: string; begin LDriveLetter := ExtractFileDrive(APath);

SetLength\(LNewPath, MAX\_PATH \+ 1\);
SetLength\(LNewPath, QueryDosDevice\(PChar\(LDriveLetter\), PChar\(LNewPath\), Length\(LNewPath\)\)\);
if Pos\('\\??\\', LNewPath\) = 1 then
  LNewPath := StrPas\(@LNewPath\[5\]\)
else
  LNewPath := '';

if LNewPath = '' then
  Result := APath
else
  Result := LNewPath \+ Copy\(APath, 3, MaxInt\);

end;

firebird-automations commented 13 years ago

Commented by: nandod (nandod)

Apparently, this did work until Firebird 1.5.

firebird-automations commented 13 years ago
Modified by: nandod (nandod) Version: 1\.5\.6 \[ 10225 \] =\> Version: 1\.5\.5 \[ 10220 \] =\> Version: 1\.5\.4 \[ 10100 \] =\>