cpierce/cakephp-sybasedb 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cpierce/cakephp-sybasedb

Composer 安装命令:

composer require cpierce/cakephp-sybasedb

包简介

CakePHP plugin to handle PDO MSSQL Connections using dblib

README 文档

README

Creates a PDO connection to MSSql server through Sybase dblib as a plugin for CakePHP 2.x

Background

To many people on the Internet were looking for a simple way to connect to a MSSQL db from a linux installed cakePHP app. I was one of them so after hours of research the birth of this plugin was planned. A few hours later it was completed.

Prerequisites?

  • php5-sybase package installed on your linux system (apt-get install php5-sybase)
  • enable php Sybase module in php.ini file (extension=pdo_dblib.so)
  • CakePHP 2.x app installed and baked on your server

How to use the plugin

Update your composer.json file using the following:

composer require cpierce/cakephp-sybasedb

Enable the Plugin in your app/Config/bootstrap.php file:

<?php
CakePlugin::load('SybaseDB');

If you are already using CakePlugin::loadAll();, then this step is not necessary.

Configure a database connection in app/Config/database.php file:

<?php
class DATABASE_CONFIG {

    public $default = array(
	    'datasource' => 'SybaseDB.Sybase',
        'host' => 'someplace\SQLEXPRESS',
        'login' => 'somelogin',
        'password' => 'Ur_P4ssw0rd#',
        'database' => 'some_database',
    );

}

You could also use another connection instead of $default and then specifying $useDbConfig in your model.

From here you can now access the data the normal cakePHP way:

<?php
    $this->Model->find('first');

Credit where it is due

Some of the code used was taken from the CakePHP 1.x SQLServer DBO for Microsoft Windows and altered to fit the PDO DBlib. Special thanks to the people who have used this and helped me test it (Especially Jeffery Bell and Marcel Wedel)

Change Log

Version 1.0

  • Updated for better and easier use of composer.

Version 0.3b

  • Fixed a problem with long table cell names (over 30 characters).

Version 0.2b

  • New mapping protocol thanks to version of SQL working in system now
  • Tested (save, delete, find('count', 'list', 'all', 'first', 'contain'), paginate, hasMany, belongsTo, etc.
  • Must specify $primaryKey for non "id" primary keys

统计信息

  • 总下载量: 33.74k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固