我可以安全地依靠mysql中的列名大小写吗? [英] Can I safely rely on column name case in mysql?

查看:86
本文介绍了我可以安全地依靠mysql中的列名大小写吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用驼峰式大小写命名我的mysql表列名称,并使用相同的驼峰式大小写名称从这些mysql表创建php类.我将自动生成这些php类.我想知道无论我在什么平台上运行应用程序,我都可以依靠列名大小写.因此,例如,如果我将一个列名命名为"FirstName",我是否会遇到从数据库读取列名会产生"firstname"之类的情况?

I want to name my mysql table column names using camel case and create php classes from these mysql tables with the same camel case names. I will be generating these php classes automatically. I'm wondering if I can rely on column name case no matter what platform I run my application on. So for example, if I name one column name "FirstName", will I ever encounter a time where reading the column name from the database will product "firstname" or something like that?

推荐答案

简短答案为否.

长的答案是,MySQL中某些内容的区分大小写取决于底层操作系统. (Unix是敏感的)

The long answer is that case-sensitivity for some things in MySQL depend on the underlying operating system. (Unix being the sensitive one)

此处是 MySQL中对这个问题的引用文档.

因此,底层操作系统的区分大小写在数据库和表名的区分大小写中起着重要作用.这意味着数据库名称和表名称在Windows中不区分大小写,在大多数Unix版本中也不区分大小写. Mac OS X是一个值得注意的例外,它是基于Unix的,但是使用了不区分大小写的默认文件系统类型(HFS +).

Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. One notable exception is Mac OS X, which is Unix-based but uses a default file system type (HFS+) that is not case sensitive.

也可以从有关列名称的文档中找到:

Also from the documentation on column names specifically:

列,索引和存储的例程名称在任何平台上都不区分大小写,列别名也不区分大小写.触发器名称区分大小写,不同于标准SQL.

Column, index, and stored routine names are not case sensitive on any platform, nor are column aliases. Trigger names are case sensitive, which differs from standard SQL.

这篇关于我可以安全地依靠mysql中的列名大小写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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