平面文件数据库示例 [英] Flat File Database Example

查看:189
本文介绍了平面文件数据库示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看一些简单平面文件数据库的例子,以及如何通过数据层访问它们。我之前已经写过并从平面文件读取,但是我还没有创建一个使用文本文件访问应用程序数据的数据层。



如果可能的话看到有一个使用一个简单的,自定义的平面文件数据库的数据层的教程是很好的。以XML格式保存自定义业务对象,然后将其上传的示例将很好,因为XML非常受欢迎,易于使用。



我也将感谢任何链接讨论有关平面文件数据库设计的最佳实践的网站等。



我的目标是在用户的机器上存储简单数据并使其不会需要安装任何特殊的软件(如SQL Server等)才能从存储的地方获取数据。



我知道这是一个非常笼统的问题,但是任何可以指出我正确方向的建议是值得欢迎的。

解决方案

你可能有一些混淆,可理解的定义由于今天的大量类似技术。



XML不是平面文件格式(或平面文件数据库),但是从阅读目标看来,你真正想要的是一个自包含的关系数据库,而不是一个实际的平面文件。



像其他人一样,我强烈推荐SQLite为此目的。有各种平台的绑定,.NET有 System.Data.SQLite ,在一个文件中,它们都是数据库提供程序和引擎。



使用SQLite的两大优点是实际的数据库完全包含在由应用程序控制的单个文件中,并且它支持标准SQL DDL和DML命令(即SELECT,INSERT,UPDATE,DELETE,CREATE DATABASE / TABLE等)。



对于单个用户应用程序,SQLite是一个非常好的最好的)存储应用程序数据和设置的方式。最近,已经被打破了,甚至可以支持更小规模的多用户应用程序。



但是,如果您有能力访问/使用数据库,则Oracle,MySQL,SQL Server等仍然是多用户应用程序(即使是小规模应用程序)的首选服务器。



另外,不要忘记数据库的选择不是互斥的。



您可能有一个多用户应用程序,在许多用户计算机上安装了富客户端UI。这里的中央数据库应该是一个多用户数据库,如MySQL。但是,在丰富的客户端界面中,SQLIte非常适合存储每个用户的设置,也可能在数据库无法访问时提供离线支持。


I would like to see some examples of simple flat file databases and how they are accessed through a data layer. I've written to and read from a flat file before, but I have not ever created a data layer that accessed the data for an application using text files.

If possible, it would be nice to see a tutorial that had a data layer that utilized a simple, custom flat file database. An example that saves custom business objects in XML and then uploads them would be nice because XML is so popular and easy to work with.

I would also be grateful for any links to websites that discuss best practices regarding the design of flat file databases, etc.

My goal is to have a solution for storing simple data on a user's machine and have them not need any special software installed (like SQL Server, etc.) in order to fetch the data from where it is stored.

I know this is a very general question, but any advice that can point me in the right direction is welcome.

解决方案

You may have got your definitions a bit mixed up, understandable due to the large number of similar technologies around today.

XML isn't a flat file format (or flat file database), but from reading your goal it sounds like what you really want is a self contained relational database rather than an actual flat file.

Like others, I can strongly recommend SQLite for this purpose. There are bindings for various platforms, .NET has System.Data.SQLite which, in one file, is both the database provider and engine.

The 2 big benefits of using SQLite are that the actual database is completely self contained in a single file controlled by your application, and that it supports standard SQL DDL and DML commands (ie SELECT, INSERT, UPDATE, DELETE, CREATE DATABASE/TABLE etc).

For a single user application SQLite is an excellent (one of the best) ways of storing both application data and settings. Of late there has been discsussion that it can even support smaller scale multi-user applications.

However Oracle, MySQL, SQL Server etc are still definitely preferred for multi-user applications (even small-scale applications) if you have the ability to access/utilise a database server.

Also, don't forget that choice of database is not mutually exclusive.

You may have a multi-user application with a rich client UI installed on many users computers. The central database here should really be a multi-user db such as MySQL. But within the rich client UI, SQLIte is ideal to store each users settings, or perhaps to provide off-line support when the database can't be reached.

这篇关于平面文件数据库示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆