我想使用驼峰式命名我的 mysql 表列名称,并使用相同的驼峰式名称从这些 mysql 表创建 php 类。我将自动生成这些 php 类。我想知道无论我在哪个平台上运行我的应用程序,我是否都可以依赖列名大小写。因此,例如,如果我将一个列名称命名为“FirstName”,我是否会遇到从数据库中读取列名称会产生“firstname”或类似名称的情况?
最佳答案
简短的回答是否定的。
长话短说,MySQL 中某些事物的大小写敏感性取决于底层操作系统。 (Unix 是敏感的)
这里是对 MySQL documentation. 中问题的引用
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.
还特别来自关于列名的文档:
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.
关于php - 我可以安全地依赖 mysql 中的列名大小写吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12045806/