Skip to content

Commit 3e33abf

Browse files
authored
fixes (#660)
* fixed limit variable ordering in the comments * Expand readme on autoreconnect and multipe connections usage
1 parent d6f0dae commit 3e33abf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

readme.md

+24
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ If no table prefix were set during object creation its possible to set it later
7878
$db->setPrefix ('my_');
7979
```
8080

81+
If connection to mysql will be dropped Mysqlidb will try to automatically reconnect to the database once.
82+
To disable this behavoir use
83+
```php
84+
$db->autoReconnect = false;
85+
```
86+
8187
If you need to get already created mysqliDb object from another class or function use
8288
```php
8389
function init () {
@@ -92,6 +98,24 @@ If you need to get already created mysqliDb object from another class or functio
9298
}
9399
```
94100

101+
### Multiple database connection
102+
If you need to connect to multiple databases use following method:
103+
```php
104+
$db->addConnection('slave', Array (
105+
'host' => 'host',
106+
'username' => 'username',
107+
'password' => 'password',
108+
'db'=> 'databaseName',
109+
'port' => 3306,
110+
'prefix' => 'my_',
111+
'charset' => 'utf8')
112+
);
113+
```
114+
To select database use connection() method
115+
```php
116+
$users = $db->connection('slave')->get('users');
117+
```
118+
95119
### Objects mapping
96120
dbObject.php is an object mapping library built on top of mysqliDb to provide model representation functionality.
97121
See <a href='dbObject.md'>dbObject manual for more information</a>

0 commit comments

Comments
 (0)