Say you have an application that saves image(.jpg, .png etc) and text(.txt, .xml) files, and the application has all of the files paths hard coded throughout code, per the example below.
Assuming the following file path structure exists:
- jpg -
- png -
- txt -
- xml -
The files in the destination file paths are referenced inside of a table, so in a VBA example the file path would be hard coded as:
Dim myFilePath as String Dim myFileName as String myFileName = "puppies.jpg" 'This would be the result of a query in a real scenario myFilePath = "\\MyFileServer\Media\jpeg\" & myFileName
Now say I have to split
What would have been ideal is if I had a central location that I could have just changed a table value or variable, rather than trudging through every single function in the application to update the hard coded path. Just to change it again in the future if the situation arises again. So, my goal is to make sure my puppies image can be shown with minimal effort.
Concerning industry standard, I was wondering what is the best option, be it my two options below or another separate option.
Single Self Referential Table:
Defined in Mike's answer at hierarchical/tree database for directories in filesystem by a hierarchical structure like the following:
(ROOT) / \ Dir2 Dir3 / \ \ Dir4 Dir5 Dir6 / Dir7
You simply have a table like the following:
ID ParentID FilePath ______________________________________________ 1 NULL \\MyFileServer 2 1 \Images 3 2 \jpg 4 3 \10 MB Files
OR Option 2: Self Referential Table With Master Roots:
A slight deviation on option 1.
Perhaps a master file path would be clearer. Where there is a separate table.
ID Name FilePath ______________________________________________ 1 Image Root \\MyMediaFileServer\Images 2 Text Root \\MyTextFileServer\Text
Then in the structure mentioned in option 1.
ID ParentID RootID FilePath ______________________________________________ 1 NULL 1 \jpg 2 1 NULL \10 MB Files
I feel that option 1 is overall more simple to change, but will become more confusing as a tree expands, and option 2 allows for an easier absolute file path change. IS Option 1 the best solution to storing file paths or is there another industry standard I am not aware of?