在 CakePHP 2.0 中使用 Oracle 数据库

Using Oracle database with CakePHP 2.0(在 CakePHP 2.0 中使用 Oracle 数据库)
本文介绍了在 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 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)