作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2011, Vol. 37 ›› Issue (5): 41-43. doi: 10.3969/j.issn.1000-3428.2011.05.014

• 软件技术与数据库 • 上一篇    下一篇

数据库中文件夹的整体存储与随机访问

李昌贵,吕志平   

  1. (信息工程大学测绘学院,郑州 450052)
  • 出版日期:2011-03-05 发布日期:2012-10-31
  • 作者简介:李昌贵(1981-),男,博士研究生,主研方向:空间信息服务;吕志平,教授
  • 基金资助:
    国家“863”计划基金资助项目(2009AA12Z305);国家自然科学基金资助项目(40874008)

Whole Storage and Random Access of Folder in Database

LI Chang-gui, LV Zhi-ping   

  1. (Institute of Surveying and Mapping, Information Engineering University, Zhengzhou 450052, China)
  • Online:2011-03-05 Published:2012-10-31

摘要: 当前的数据库系统不能提供对文件夹存取的直接支持。针对该问题,综合数据库二进制大对象(BLOB)技术、流技术和序列化技术,提出一种数据库中文件夹的整体存储和随机访问方法。将文件夹打包成连续的文件数据块和目录结构对象,序列化目录结构对象为目录结构数据块,保存文件数据块和目录结构数据块至数据库的BLOB列。访问数据库文件时,读取目录结构BLOB为目录结构数据块,通过反序列化将其恢复成目录结构对象。从目录结构对象中可选择欲访问的文件,确定其在文件数据BLOB中的位置和大小,读取其对应的数据,从而实现对数据库中文件夹的随机访问。

关键词: 二进制大对象, 文件夹, 数据库, 整体存储, 随机访问

Abstract: Existing database system can not support to store a whole folder into a database and provide random access to any file in it. Aiming at this problem, this paper puts forward a method to store a folder as a whole and access its file randomly in a database based on the integration of Binary Large Object(BLOB), stream and serialization technology. The folder is packed up, resulting in a file stream and a directory structure object. The directory structure object is serialized to a directory structure stream. The file stream and directory structure stream are saved as BLOB data in a database respectively. When reading from the database, it first reads the directory structure BLOB data as a stream, and deserializes it to the directory structure object. With the information in the directory structure object, it can choose which file to access and ascertain its location and size in the folder’s file BLOB data. It reads the corresponding data section out of the database and realize the random access of a file.

Key words: Binary Large Object(BLOB), folder, database, whole storage, random access

中图分类号: