Using Oracle database with CakePHP 2.0(在 CakePHP 2.0 中使用 Oracle 数据库)
问题描述
我注意到 CakePHP 2.0 中暂时没有 Oracle 数据源,尽管他们现在似乎正在处理它:http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0
I have noticed there's no datasource for Oracle in CakePHP 2.0 for the moment, although it seems they are working on in it now: http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0
有些人解释了如何使用 Oracle DB 改编 CakePHP 1.3 的一些代码:http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/
There are some people explaining how to use an Oracle DB adapting some code from CakePHP 1.3: http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/ http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/
但我不确定这是正确的方法.如果它这么简单,他们早就为 CakePHP 2.X 发布了该功能...
But I'm not sure that's the correct way. If it was so simple, they would have released the feature already for CakePHP 2.X...
使用那个作弊"会有什么问题吗?
Would I have any trouble using that "cheat"?
我想将 CakePHP 与 PL/SQL 过程和桌面应用程序连接起来,它们正在通过 Oracle 工作.我无法改变这一点.
I want to connect CakePHP with PL/SQL procedures and a desktop application and they are working over Oracle. I can not change that.
推荐答案
在询问了一些 CakePHP 开发人员后,我得出的结论是,如果您想正确使用 CakePHP 2.3 的 Oracle 数据库是不可能的CakePHP 模型及其查询语法.CakePHP 中还没有任何适用于 Oracle 的驱动程序是完全可用的.
After asking some CakePHP developers I came out with the conclusion that it is not possible to use an Oracle Database with CakePHP 2.3 if you want to make a proper use of CakePHP Models and their query syntax. There's no yet available any driver for Oracle in CakePHP which is completely functional.
因此,我找到的解决方案是使用 OCI8 函数 PHP.
Therefore, the solution I found was to use the OCI8 Functions of PHP.
像这样,我可以使用 oci_parse
直接查询数据库,或者调用 PL-SQL 过程,这是我最终决定要做的.(由于sql函数复杂,工作组内部任务分工)
Like this i could use oci_parse
to directly query against the DB or rather call a PL-SQL procedure which is what I finally decided to do. (because of the sql functions complexity and the division of task inside my work group)
现在,我无法利用使用 CakePHP 模型的许多优点,但这是唯一的方法.
Now, I can not make use of many of the advantages of using CakePHP models, but It was the only way.
这篇关于在 CakePHP 2.0 中使用 Oracle 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 CakePHP 2.0 中使用 Oracle 数据库


基础教程推荐
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01