File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ If no table prefix were set during object creation its possible to set it later
78
78
$db->setPrefix ('my_');
79
79
```
80
80
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
+
81
87
If you need to get already created mysqliDb object from another class or function use
82
88
``` php
83
89
function init () {
@@ -92,6 +98,24 @@ If you need to get already created mysqliDb object from another class or functio
92
98
}
93
99
```
94
100
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
+
95
119
### Objects mapping
96
120
dbObject.php is an object mapping library built on top of mysqliDb to provide model representation functionality.
97
121
See <a href =' dbObject.md ' >dbObject manual for more information</a >
You can’t perform that action at this time.
0 commit comments