PHPackages                             misuoka/ocipdo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. misuoka/ocipdo

ActiveLibrary

misuoka/ocipdo
==============

基于 OCI API 封装的 Oracle PDO 数据库驱动

v0.1.8(5y ago)180711MITPHPPHP &gt;=7.0CI failing

Since Apr 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/misuoka/ocipdo)[ Packagist](https://packagist.org/packages/misuoka/ocipdo)[ RSS](/packages/misuoka-ocipdo/feed)WikiDiscussions 0.1 Synced 1mo ago

READMEChangelogDependencies (1)Versions (11)Used By (1)

ocipdo
======

[](#ocipdo)

基于 OCI API 封装的 Oracle PDO 数据库驱动

说明
--

[](#说明)

由于官方很久没有对 PDO\_OCI 更新了，其驱动源码默认不支持 Oracle 11g 及以上版本的数据库。当然也可在编译前修改 config.m4 文件使之支持，但安装之后，PDO\_OCI 使用中却存在问题，如果数据库中存储中文，查询后会出现字符截断，无法得到预期的结果。

本库使用基于 OCI API 封装的 PDO 接口数据库驱动 [misuoka\\ocipdo](https://github.com/misuoka/ocipdo)，用来对 Oracle 数据库进行操作。

> 有关 PDO\_OCI 字符截断问题的链接：

使用方法
----

[](#使用方法)

### 使用前提

[](#使用前提)

你的运行环境已经安装了 oci 驱动

> 安装方法可参考：
>
> 1. Windows 环境下
> 2. Linux 环境下

### 安装 ocipdo

[](#安装-ocipdo)

使用 composer 进行安装 `composer require misuoka/ocipdo`

```
use ocipdo\PDO as OCIPDO;

// $dns => oci:dbname=//localhost:1521/orcl
// $username => 用户名
// $password => 密码
$pdo = new OCIPDO($dns, $username, $password);
```

注意事项
----

[](#注意事项)

由于 Oracle 数据库中有 CLOB 和 BLOB 字段，CLOB 是存储文本大对象，BLOB 是存储二进制大对象，在 OCI 中二者对应的数据类型不一样：

- 使用 `oci_bind_by_name` 绑定 `CLOB` 数据时，需要设置的类型为 `SQLT_CLOB`。
- 使用 `oci_bind_by_name` 绑定 `BLOB` 数据时，需要设置的类型为 `SQLT_BLOB`。

而 PDO 的预定义常量中，只有 `PDO::PARAM_LOB` 是对大对象数据的类型定义，无法区分用户要写入的数据字段是 `CLOB` 还是 `BLOB`，故本驱动 [misuoka\\ocipdo](https://github.com/misuoka/ocipdo) 进行了如下设定：

- `PDO::PARAM_LOB` 对应于要写入的是 `CLOB` 数据
- `PDO::PARAM_LOB + PDO::PARAM_LOB` 对应于要写入的是 `BLOB` 数据

```
$ret = $stmt->bindValue(':CLOB_CONTENT', $data['CLOB_CONTENT'], \PDO::PARAM_LOB); // 写入 CLOB 数据
$ret = $stmt->bindValue(':BLOB_CONTENT', $data['BLOB_CONTENT'], \PDO::PARAM_LOB + \PDO::PARAM_LOB); // 写入 BLOB 数据
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Recently: every ~0 days

Total

9

Last Release

2185d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0051ad9a710fbffbe26540c10f0d9702be59bb0d1f9d9dea9f6b4603ecc7f935?d=identicon)[misuoka](/maintainers/misuoka)

---

Top Contributors

[![misuoka](https://avatars.githubusercontent.com/u/8513089?v=4)](https://github.com/misuoka "misuoka (13 commits)")

---

Tags

pdooraclepdo\_ocioci

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/misuoka-ocipdo/health.svg)

```
[![Health](https://phpackages.com/badges/misuoka-ocipdo/health.svg)](https://phpackages.com/packages/misuoka-ocipdo)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8703.0M17](/packages/yajra-laravel-oci8)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M231](/packages/nette-database)[taq/pdooci

Replacement for the PHP PDO OCI class

67144.0k1](/packages/taq-pdooci)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
