平面文件数据库 PHP 应用程序

发布于 2024-08-09 13:28:42 字数 481 浏览 7 评论 0原文

我正在创建依赖于数据库的应用程序,并且我完全打算使用平面文件数据库,是否有任何严重的理由要远离此?

我正在使用 mimesis (http://mimesis.110mb.com) 它比使用 mySQL 更简单,我不得不承认我对此没什么经验。 我想知道数据库的安全性。但文件存储为 php,它似乎是一个可靠的数据库解决方案。

我真的很喜欢备份和传输数据库的便利性,但我发现 mySQL 更难做到这一点。我发现每个人似乎都更喜欢 mySQL 方式 - 而且在查询方面它可能更快,但除此之外,还有什么理由远离平面文件数据库并(最终)正确学习 mysql 吗?


编辑 只是为了让人们知道, 我最终选择了 mySQL,并使用 CodeIgniter 框架。仍然喜欢平面文件数据库,但现在意识到对于这个项目来说它比必要的要复杂得多。

I'm creating and app that will rely on a database, and I have all intention on using a flat file db, is there any serious reasons to stay away from this?

I'm using mimesis (http://mimesis.110mb.com)
it's simpler than using mySQL, which I have to admit I have little experience with.
I'm wondering about the security of the db. but the files are stored as php and it seems to be a solid database solution.

I really like the ease of backing up and transporting the databases, which I have found harder with mySQL. I see that everyone seems to prefer the mySQL way - and it likely is faster when it comes to queries but other than that is there any reason to stay away from flat-file dbs and (finally) properly learn mysql ?


edit
Just to let people know,
I ended up going with mySQL, and am using the CodeIgniter framework. Still like the flat file db, but have now realized that it's way more complex for this project than necessary.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

岁月静好 2024-08-16 13:28:42

使用 SQLite,您将获得一个具有许多 SQL 功能的数据库,但它只是一个文件。

Use SQLite, you get a database with many SQL features and yet it's only a single file.

↘紸啶 2024-08-16 13:28:42

大家好,我是 Mimesis 的创建者。在需要处理大量数据的情况下,关系数据库和 SQL 非常重要。平面文件是否优于关系数据库?好吧,你可以问谷歌,因为他们的整个归档系统都使用平面文件,而且它是地球上最受欢迎的搜索引擎。 Mimesis 与他们的系统相比吗?可能不会。

Mimesis 的创建是为了解决特定的利基问题。我只使用免费网站进行在线活动。许多免费网站都提供使用 PHP 的功能。但是,他们不提供免费的 SQL 数据库访问。因此,我需要创建一个数据库来存储数据、实现锁定并解决文件权限问题。这些是 Mimesis 的主要设计参数,它在所有这些方面都取得了成功。

如果您需要了解 Mimesis 的速度,如果您导航到第一页,它会告诉您正在哪个国家/地区查看该网站。这个免费数据库取自 ip2nation.com 网站并移植到 Mimesis ffdb 中。它有数百甚至数千个条目。

此外,主页上的点击计数器已跟踪超过 7000 名访问者。这些是唯一访问,这意味着脚本必须搜索数据库以查看正在访问的 IP 地址是否已存在,并且还执行总 IP 的计数。

如果您注意到主页加载得非常快,并且它有两个相当密集的 Mimesis 数据库脚本在后端运行。 Mimesis 存储数据的方式是为了加速读写过程以及翻译过程。大多数 ffdb 示例脚本或其他 ffdb 脚本使用简单的 CVS 文件或其他类似结构来存储数据。 Mimesis 实际上在某些级别上解释二进制数据以增强其功能。 Mimesis 在某种程度上是平面文件数据库和关系数据库的混合体。

大多数其他 ffdb 脚本都会在每次更新时重写完整文件。 Mimesis 不会这样做,它仅重写结构文件并更新实际的行内容。这样,即使确实发生错误,您也只会丢失添加的新数据,而不会丢失任何旧数据。模仿也保留着它的历史。除非刷新表,否则行之前的数据仍然包含在其中。

我可以继续谈论所有功能,但这并不是为了“Mimesis 是有史以来最伟大的数据库”的咆哮。此外,它的目的是让人们认识到这样一个事实:SQL 并不是唯一可用的技术,并且考虑到平面文件更加专业,在给予适当的开发范例时,平面文件优于关系数据库。

平面文件和勇敢面对随之而来的头痛的程序员万岁。

Greetings, I'm the creator of Mimesis. Relational databases and SQL are important in situations where you have massive amounts of data that needs to be handled. Are flat files superior to relation databases? Well, you could ask Google, as their entire archiving system works with flat files, and its the most popular search engine on Earth. Does Mimesis compare to their system? Likely not.

Mimesis was created to solve a particular niche problem. I only use free websites for my online endeavors. Plenty of free sites offer the ability to use PHP. However, they don't provide free SQL database access. Therefore, I needed to create a database that would store data, implement locking, and work around file permissions. These were the primary design parameters of Mimesis, and it succeeds on all of those.

If you need an idea of Mimesis's speed, if you navigate to the first page it will tell you what country you're viewing the site from. This free database is taken from the site ip2nation.com and ported into a Mimesis ffdb. It has hundreds if not thousands of entries.

Furthermore, the hit counter on the main page has already tracked over 7000 visitors. These are UNIQUE visits, which means that the script has to search the database to see if the IP address that's visiting already exists, and also performs a count of the total IPs.

If you've noticed the main page loads up pretty quickly and it has two fairly intensive Mimesis database scripts running on the backend. The way Mimesis stores data is done to speed up read and write procedures and also translation procedures. Most ffdb example scripts or other ffdb scripts out there use a simple CVS file or other some such structure for storing data. Mimesis actually interprets binary data at some levels to augment its functionality. Mimesis is somewhat of a hybrid between a flat file database and a relational database.

Most other ffdb scripts involve rewriting the COMPLETE file every time an update is made. Mimesis does not do this, it rewrites only the structural file and updates the actual row contents. So that even if an error does occur you only lose new data that's added, not any of the older data. Mimesis also maintains its history. Unless the table is refreshed the data that rows had previously is still contained within.

I could keep going on about all the features, but this isn't intended as a "Mimesis is the greatest database ever" rant. Moreso, its intended to open people's eyes to the fact that SQL isn't the ONLY technology available, and that flat files, when given proper development paradigms are superior to a relational database, taking into account they are more specialized.

Long live flat files and the coders who brave the headaches that follow.

浊酒尽余欢 2024-08-16 13:28:42

如果您只需要平面文件结构,答案是“很好”。一项测试:一个简单的电子表格可以满足所有需求吗?如果没有,您需要一个关系结构,而不是平面文件。

如果您不确定,也许您可​​以开始平面文件。 SQLite 是一款非常适合入门的应用程序。

如果你在这个过程中发现自己做出了错误的选择,那就不好了。但是,如果您了解关系结构的重要性,并在需要时尽早扩大规模,那么就可以了。

The answer is "Fine" if you only NEED a flat-file structure. One test: Would a single simple spreadsheet handle all needs? If not, you need a relational structure, not a flat file.

If you're not sure, perhaps you can start flat-file. SQLite is a great app for getting started.

It's not good to learn you made the wrong choice, if you figure it out too far along in the process. But if you understand the importance of a relational structure, and upsize early on if needed, then you are fine.

高速公鹿 2024-08-16 13:28:42

我真的很喜欢备份的便捷性
并传输数据库,其中
我发现 mySQL 更困难。

使用另一个答案中提到的 SQLite 。只需要备份一个文件,或者设置定期将 MySQL 数据库转储到 SQL 文件。这是一件相对简单的事情。

我发现每个人似乎都更喜欢
mySQL 方式 - 很可能是
查询速度更快

速度绝对是一个考虑因素。数据库往往要快得多,因为数据组织得更好。

除此之外还有什么理由
远离平面文件数据库并且
(终于)正确学习mysql了?

使用数据库解决方案确实有很多理由,但对于平面文件则有一些争论。学习“通常”使用之外的东西总是好的。
大多数决定取决于应用程序。您将拥有多少个并发用户?您需要交易支持吗?

I really like the ease of backing up
and transporting the databases, which
I have found harder with mySQL.

Use SQLite as mentioned in another answer. There is only one file to backup, or set up periodic dumps of the MySQL databases to SQL files. This is a relatively simple thing to do.

I see that everyone seems to prefer
the mySQL way - and it likely is
faster when it comes to queries

Speed is definitely a consideration. Databases tend to be a lot faster, because the data is organized better.

other than that is there any reason to
stay away from flat-file dbs and
(finally) properly learn mysql ?

There sure are plenty of reasons to use a database solution, but there are arguments to be made for flat files. It is always good to learn things other than what you "usually" use.
Most decisions depend on the application. How many concurrent users are you going to have? Do you need transaction support?

萌梦深 2024-08-16 13:28:42

想要告知 Mimesis 已从原始 URL 移至 http://mimesis.site11.com/

此外,我正在将 Mimesis 的重点从 ffdb 转移到键值存储。考虑到我存储的信息类型以及我用来检索它的方法,这是更明智的。 Mimesis 的编码中也存在严重错误(我已经修复了)。但是,我仍处于新键值存储类型的测试阶段。我也曾被其他事情所困扰。锁定也从使用文件创建更改为目录创建作为互斥机制。

Wanted to inform that Mimesis has moved from the original URL to http://mimesis.site11.com/

Furthermore, I am shifting the focus of Mimesis from an ffdb to a key-value store. It's more sensible Given the types of information I'm storing and the methods I use to retrieve it. There was also a grave error present in the coding of Mimesis (which I've since fixed). However, I'm still in the testing phase of the new key-value store type. I've also been side-tracked by other things. Locking has also been changed from the use of file creation to directory creation as the mutex mechanism.

不交电费瞎发啥光 2024-08-16 13:28:42

互操作性。 MySQL 基本上可以与任何重要的语言进行交互。 Mimesis 不太可能在 PHP 之外使用。

当您尝试使用分析器或从外部修改数据时,这一点就变得很重要。

Interoperability. MySQL can be interfaced by basically any language that counts. Mimesis is unlikely to be usable outside PHP.

This becomes significant the moment you try to use profilers, or modify data from the outside.

偏爱自由 2024-08-16 13:28:42

您还可以查看 http://lukeplant.me.uk/resources/flatfile/用于 PHP 平面文件包。

You might also look at http://lukeplant.me.uk/resources/flatfile/ for the PHP Flatfile Package.

倒带 2024-08-16 13:28:42

使用平面文件的问题是,为了调整情况以进行进一步的开发,您必须更改大量代码以改善系统的基础。然而,如果它是一个纯 SQL 系统,则将来几乎不需要任何修改即可继续。

The issue with going flatfile is that in order to adjust the situation for further development you have to alter a significant amount of code in order to improve the foundation of the system. Whereas if it was a pure SQL system it would require little to no modification to proceed in the future.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文