定制 eclipxe/engineworks-dbal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

eclipxe/engineworks-dbal

最新稳定版本:v2.3.7

Composer 安装命令:

composer require eclipxe/engineworks-dbal

包简介

PHP Database Abstraction Layer

README 文档

README

Source Code Packagist PHP Version Support Latest Version Software License Build Status Reliability Maintainability Code Coverage Violations Total Downloads

I create this library to abstract the interactions with a relational database. At the time it was created the PDO extension did not exist. If possible try to use PDO instead of this library, mostly because prepared statements.

I'm maintaining this library because I have several applications depending on it, and I had shared this to other people, so they can also maintain their own projects.

Installation

To install this library you can use:

composer require eclipxe/engineworks-dbal

Objects

EngineWorks\DBAL\DBAL

Main connection object, has several query methods to get the results just as needed. It also contains sql methods to translate SQL Dialects from different drivers.

EngineWorks\DBAL\Recordset

The Recordset class mimics the main methods of the recordset:

  • Open the recordset using an SQL Statement.
  • Walk the recordset using the current cursor.
  • Access values using the values array, stores original values.
  • Use of magic methods Update and Delete.
  • Convert from/to database types to common types.

Some drivers do not know how to get the primary keys on a query, in that case you can specify the entity to affect and also the primary keys.

Mysql driver support this feature, it will check for primary keys, auto incrementing fields or unique indexes.

EngineWorks\DBAL\Pager

The Pager class uses Recordset to access a limited page of a query, it does not load all the records but only the requested ones

About drivers

This library supports Mysqli, Mssql, Sqlsrv and Sqlite3 drivers, you are free to create your own and (please) share it with me.

Mysqli

  • This is the most tested driver on production.

Sqlsrv

  • This driver uses Microsoft PHP Driver for SQL Server.
  • Result does not know the entity or primary keys of the query. Use overrideEntity and overrideKeys when create a Recordset for update or delete.

Sqlite3

  • Result does not know the entity or primary keys of the query. Use overrideEntity and overrideKeys when create a Recordset for update or delete.
  • When a result is empty (nothing to fetch) it is not possible to know the type of the fields, this make this driver unstable to update using Recordset.
  • The method SQLite3Result::fetchArray put the cursor in the first position when called after end of list. This behavior has been corrected on Result and fetch returns always false.

Mssql

  • This driver uses PDO dblib, you will need FreeTDS.
  • Result does not know the entity or primary keys of the query. Use overrideEntity and overrideKeys when create a Recordset for update or delete.
  • The function to quote (PDO::quote) fail with multibyte strings, we are using simple replacements of ' to ''
  • This driver is not really compatible with PHP 7, use Sqlsrv instead

Compatibility

This class will be compatible according to PHP Supported versions.

Contributing

Contributions are welcome! Please read CONTRIBUTING for details and don't forget to take a look in the files TODO and CHANGELOG.

License

The eclipxe/engineworks-dbal library is copyright © Carlos C Soto and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

统计信息

  • 总下载量: 1.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-01