php pdo 连接oracle,PHP: Oracle (PDO) - Manual

Notice the red block at the beginning of this page... pdo_oci is HIGHLY experimental.

Even though it is under dev from 2004, it lakes today support for things that _do_ matters :

- bind a varchar2 of 3500 chars

- get selected metas

- left join with blobs/clobs

- etc.

For the story, since we use pdo_pgsql in our software, I thought it would be viable to use pdo_oci for running under Oracle. After a long battle, I finally won :

1) If requested driver has a non-experimental pdo version available, use it.

2) else (well, for pdo_oci at least), use an abstraction layer of your own.

3) you're done.

What I did in more details...

2 "main" classes for being compliant with "$obj instanceof PDO" or such :

- class PhpDb extends PDO

- class PhpDbStatement extends PDOStatement

2 "abstract" classes that defines what PDO actually does :

- abstract class PhpDbAbstract

- abstract class PhpDbAbstractStatement

And at last for each driver, 2 classes doing the abstraction :

- class PhpDbDriverOracle extends PhpDbAbstract

- class PhpDbDriverOracleStatement extends PhpDbAbstractStatement

"main" classes are accessed from your script, simply replace "new PDO" with "new PhpDb".

"abstract" classes are mainly there for the documentation :p

"driver" classes do the job in background, they are instances by the main classes.

My PhpDb will be in an open source project sooner or later, search google or mail me !

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值