本文介绍了我是引用目录路径还是只引用数据库中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间后,我得到了很好的建议,关于如何通过在数据库中引用文件来处理文件,而不是将文件作为blob上传。我正在创建一个家谱数据库,但是,有一些事情需要解决。今天,我想从我的个人目录开始。我已经设置了我的代码,以便在添加到数据库时根据人员的ID号创建目录。我想弄清楚的是我应该将目录路径链接到人员的个人资料并在目录中显示文件,还是应该将文件路径保存在数据库中?哪种方式更适合设计目的?



我尝试过的方法:



截至目前,我的数据库设置为使用文件路径。这种方法运行良好,但是,由于会有多种类型的文件和文件夹(目录)与一个人相关,我不确定文件方法是否足够。

Awhile back I was given great advice about how to handle files by referencing them in the database instead of uploading the files as blobs. I am in the process of creating a genealogy database, however, there are a few things I have to work out. Today, I would like to start with my individual person directory. I have set up my code to create a directory based on the person's ID number when added to the database. What I am trying to figure out is should I link the directory path to the person's profile and show files in the directory or should I keep the file paths stored in the database? which way is better for design purposes?

What I have tried:

As of now I have my database set to use the file paths. This method has worked fine, however, Since there will be multiple types of files and folder(directories) related to one individual I was unsure if the file method would be sufficient enough.

推荐答案

d:\myapp\data\Persons\1234
                        |-InfoFolder
                        |      |-file1.doc
                        |      
                        |-SomeOtherFolder



并将相关文件路径存储在我的数据库中,即 InfoFolder\file1.doc SomeOtherFolder\filexyz.doc


这篇关于我是引用目录路径还是只引用数据库中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 00:05