gabrielapg/cakephp-oracle

用于连接Oracle的包

dev-master 2021-03-01 02:00 UTC

This package is not auto-updated.

Last update: 2024-09-29 20:17:43 UTC


README

此包是基于以下项目分支的:[snelg/cakephp3-oracle](https://github.com/snelg/cakephp-3-oracle)

CakePHP 3.x的Oracle数据源

这是CakePHP 3.0的Oracle数据源的一个alpha版本。目前只实现了基本的数据读取功能;插入、删除和更新功能仅进行了最小程度的测试。

通过composer安装

使用composer将包安装到您的项目中。对于现有应用程序,您可以将以下内容添加到您的composer.json文件中

"require": {
    "gabrielapg/cakephp-oracle": "~1.0"
}

然后运行php composer.phar update

定义连接

示例连接信息

// in config/app.php
    'Datasources' => [
        // other datasources
        'my_oracle_db' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Oracle\Driver\Oracle',
            /* 'host' => '', //Usually unused for Oracle connections */
            'username' => 'you know what goes here',
            'password' => 'and here',
            'database' => 'TNS entry name or full conn string, e.g. (DESCRIPTION=(ADDRESS_LIST=( [...] )))',
            'schema' => 'SCHEMA_NAME', //The schema that owns the tables, not necessarily your login schema
        ],
    ]

如果您的数据表不是由登录用户拥有的不同模式,请确保将拥有表的模式的名称放入“schema”字段中,而不是您的登录模式。

如果您想要访问多个模式中的数据,则不需要多个数据源。相反,您可以在表的“initialize”函数中指定模式。

class UsersTable extends Table
{
    public function initialize(array $config)
    {
        $this->table('some_other_schema.users');
    }
}