CakePHP +甲骨文+ CamelCased 列表名称问题
我们正在使用 Cakephp 开发一个巨大的项目。我们已经开始使用 MySQL,但现在他们要求迁移到 Oracle!现在,我们刚刚开始这项可爱的任务! :)
我们不使用cakephp模式,而是使用驼峰式命名表及其列(这是客户要求!)。
Oracle 中的列表名称区分大小写,因为我们在创建表时将名称放在“”(双引号)之间。如果不这样做,Oracle 就会将其转为大写。
但是cakephp的oracle驱动似乎忽略了驼峰配置,解析字段名称总是不区分大小写,并在查询结果数组中将名称转换为小写。
而不是
$res['TableName']['ColumnName'] //camelcased
我得到
$res['TableName']['columnname'] //lowercased! :(
有人知道如何克服它吗?
We are working on a huge project using Cakephp. We've started using MySQL, but now they are asking to move to Oracle! Now, we've just start this lovely task! :)
We are not using cakephp patterns, but camel cased names for tables and its columns (It was a client requirement!).
Columns table names in Oracle are Case Sensitive as we put the name between "" (double quotes) when creating tables. If we don't, Oracle put uppercased.
But cakephp's oracle drive seems to ignore camelcased configuration, parse field name always as case insensitive and turns names into lowercased at the query result array.
Instead of
$res['TableName']['ColumnName'] //camelcased
I got
$res['TableName']['columnname'] //lowercased! :(
Does anybody have any idea how to overcome it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你需要和你的客户好好谈谈。如果客户要求使用驼峰式大小写,那么他们不应该使用 Oracle。你不能两者兼而有之,这将是一团糟,因为 Oracle 中的所有内容都是大写的,表、列、存储过程等等。
你最终会用“Table1”.“Column1”引号来破解所有内容。这不会是高度可维护的,并且每个 Oracle DBA 在查看数据库结构时都需要进行上下文切换。
他们(您的客户)要么需要遵循 Oracle 标准,要么不使用 Oracle。
I think you need to have a hard talk with your client. If camel casing is a client requirement then they shouldn't use Oracle. You can't have both, it will be one hacked mess, since everything in Oracle gets upper cased, tables, columns, stored procs and the list goes on.
You will end up hacking everything with "Table1"."Column1" quotes. This will not be highly maintainable and every Oracle DBA will need to context switch when they look at the database structures.
They, your client, either need go with the Oracle standards or not use Oracle.