https://github.com/bartko-s/stefano-db
[DEPRECATED]
https://github.com/bartko-s/stefano-db
Last synced: about 1 year ago
JSON representation
[DEPRECATED]
- Host: GitHub
- URL: https://github.com/bartko-s/stefano-db
- Owner: bartko-s
- Created: 2013-06-03T09:38:32.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T10:11:31.000Z (almost 4 years ago)
- Last Synced: 2025-02-24T06:18:05.323Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[DEPRECATED] Stefano Db
=======================
Zend DB from [v.2.4.0](https://github.com/zendframework/zend-db/releases/tag/release-2.4.0) support nested transactions. Please use [Zend Db](https://github.com/zendframework/zend-db/) instead of this library. This library is NOT MAINTAINED anymore.
[](https://app.travis-ci.com/bartko-s/stefano-db)
[](https://coveralls.io/r/bartko-s/stefano-db?branch=master)
Installation using Composer
--------------------------
1. Run command ``` composer require stefano/stefano-db ```
Features
------------
- extend Zend Framework 2 Database adapter. For more info see [Zend Db](http://framework.zend.com/manual/2.3/en/index.html#zend-db)
- nested transaction. For more info see [Stefano nested transaction](https://github.com/bartko-s/stefano-nested-transaction/)
- execute defined queries after db connection will be created
Db Adapter Configuration
------------------------
```
//$option for more info see Zend Framework 2 Db documentation
$adapter = new \StefanoDb\Adapter\Adapter($options);
```
Nested transaction API
----------------------
```
$adapter->begin();
$adapter->commit();
$adapter->rollback();
```
Usage with Zend Framework 2 MVC
-------------------------------
- single DB connection configuration
```
return array(
//single DB connection
'db' => array(
'driver' => '',
'database' => '',
'username' => '',
'password' => '',
'sqls' => array(
"SET time_zone='+0:00'",
"....."
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> '\StefanoDb\Adapter\Service\AdapterServiceFactory',
),
),
);
```
- multiple DB connection configuration
```
return array(
'db' => array(
'adapters' => array(
'Db/Write' => array(
'driver' => '',
'database' => '',
'username' => '',
'password' => '',
'sqls' => array(
"SET time_zone='+0:00'",
"....."
),
),
'Db/Read' => array(
'driver' => '',
'database' => '',
'username' => '',
'password' => '',
'sqls' => array(
"SET time_zone='+0:00'",
"....."
),
),
),
),
'service_manager' => array(
'abstract_factories' => array(
'\StefanoDb\Adapter\Service\AdapterAbstractServiceFactory',
),
),
);
```