Skip to content

Commit

Permalink
fixes (#660)
Browse files Browse the repository at this point in the history
* fixed limit variable ordering in the comments

* Expand readme on autoreconnect and multipe connections usage
  • Loading branch information
avbdr committed Aug 2, 2017
1 parent d6f0dae commit 3e33abf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions readme.md
Expand Up @@ -78,6 +78,12 @@ If no table prefix were set during object creation its possible to set it later
$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
```php
function init () {
Expand All @@ -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
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>
Expand Down

0 comments on commit 3e33abf

Please sign in to comment.