在 CakePHP 2.0 中使用 Oracle 数据库 [英] Using Oracle database with CakePHP 2.0

查看:42
本文介绍了在 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 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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