前缀MySQL表或许多MySQL数据库? [英] Prefixing MySQL Tables or Many MySQL databases?

查看:101
本文介绍了前缀MySQL表或许多MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,首先,我是一名学生.我正在开发一个应用程序,其他学生可以在其中访问MySQL数据库.基本上,我想让学生不必在主机上搜索托管甚至安装MySQL.另一个优点是,他们只需浏览网站即可向班级展示他们的作品.因此,我的想法是为每个人使用相同的数据库,并为学生添加一个登录系统.这样,我可以为每个学生关联一个前缀,他们可以执行任何类型的查询,而不必担心它是否会与某人的表发生冲突,因为系统会自动为他们的查询表添加前缀.我的想法是限制每个用户可以拥有多少表和行,这对于解析器来说应该不难.它不一定是PHP的解析器,它可以是perl或python. PHP更加方便.由于Windows,.NET会更加麻烦

So, first things first, I'm a student. I'm developing an application where other students can have access to a MySQL database. Basically, I wanted to spare the students the need to search for hosting or even installing MySQL on their computers. Another plus is the fact that they can present their works to the class just by browsing a website. So, my idea was to use the same database for everyone, and add a login system for the students. This way, I can associate a prefix to every student, and they can execute any type of query without worrying if it will clash with someone's table, because the system would prefix their queries tables automatically. My idea was to limit how much tables and rows each user can have, which shouldn't be hard with a parser. It doesn't necessarily need to be a parser in PHP, it could be in perl or python. PHP is just more convenient. .NET would be more troublesome because of Windows

顺便说一句,数据库系统入门"的每个班级大约有50名学生,并且有3个班级,因此可以达到大约150名学生...

By the way, each class of "introduction to database systems" has around 50 students and there are 3 classes, so it could reach about 150 students...

例如,SELECT * FROM员工 必须成为 SELECT * FROM prefix_employees 我不知道查询的样子,它可能会变得相当复杂,因此我可能需要一个写得很好的解析器,而对于PHP,我还没有找到它.

For example, SELECT * FROM employees has to become SELECT * FROM prefix_employees I do not know how the query will look like, it could get fairly complex so I'd probably need a well written parser, which I haven't found yet for PHP.

谢谢大家,我希望我已经说清楚了

Thanks guys, I hope I have made myself clear

推荐答案

不幸的是,MySQL没有(AFAIK)具有 PostgreSQL )具有它们(用于分隔内容) (表等)在逻辑上位于一个数据库中.)

Unfortunately, MySQL does not (AFAIK) have schemas as some other databases (e.g. PostgreSQL) have them (for seperating content (tables, etc...) logically within one database).

但是我会绝对选择单独的数据库方案.

But I would definitely go for the seperate databases-scenario.

您的解析器(带有前缀sheme")将被破坏(不情愿,也可能会不情愿),除非您愿意花费大量时间进行这项工作.

Your parser (with the 'prefixing sheme') will be broken (unwillingly and also possibly willingly) unless you are willing to put an extreme amount of time into making this work.

这篇关于前缀MySQL表或许多MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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