Commit 3e33abfc authored by Alexander Butenko's avatar Alexander Butenko Committed by GitHub

fixes (#660)

* fixed limit variable ordering in the comments

* Expand readme on autoreconnect and multipe connections usage
parent d6f0dae9
...@@ -78,6 +78,12 @@ If no table prefix were set during object creation its possible to set it later ...@@ -78,6 +78,12 @@ If no table prefix were set during object creation its possible to set it later
$db->setPrefix ('my_'); $db->setPrefix ('my_');
``` ```
If connection to mysql will be dropped Mysqlidb will try to automatically reconnect to the database once.
To disable this behavoir use
```php
$db->autoReconnect = false;
```
If you need to get already created mysqliDb object from another class or function use If you need to get already created mysqliDb object from another class or function use
```php ```php
function init () { function init () {
...@@ -92,6 +98,24 @@ If you need to get already created mysqliDb object from another class or functio ...@@ -92,6 +98,24 @@ If you need to get already created mysqliDb object from another class or functio
} }
``` ```
### Multiple database connection
If you need to connect to multiple databases use following method:
```php
$db->addConnection('slave', Array (
'host' => 'host',
'username' => 'username',
'password' => 'password',
'db'=> 'databaseName',
'port' => 3306,
'prefix' => 'my_',
'charset' => 'utf8')
);
```
To select database use connection() method
```php
$users = $db->connection('slave')->get('users');
```
### Objects mapping ### Objects mapping
dbObject.php is an object mapping library built on top of mysqliDb to provide model representation functionality. dbObject.php is an object mapping library built on top of mysqliDb to provide model representation functionality.
See <a href='dbObject.md'>dbObject manual for more information</a> See <a href='dbObject.md'>dbObject manual for more information</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment