From 1fb2d706c4f263d8c210ad3b16812ae68958bacb Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Wed, 2 Aug 2017 11:16:59 -0400 Subject: [PATCH 1/4] fixed limit variable ordering in the comments --- MysqliDb.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MysqliDb.php b/MysqliDb.php index 48a705b0..1fa07a43 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -582,7 +582,7 @@ public function rawQueryValue($query, $bindParams = null) * A method to perform select query * * @param string $query Contains a user-provided select query. - * @param int|array $numRows Array to define SQL limit in format Array ($count, $offset) + * @param int|array $numRows Array to define SQL limit in format Array ($offset, $count) * * @return array Contains the returned rows from the query. */ @@ -654,7 +654,7 @@ public function withTotalCount() * A convenient SELECT * function. * * @param string $tableName The name of the database table to work with. - * @param int|array $numRows Array to define SQL limit in format Array ($count, $offset) + * @param int|array $numRows Array to define SQL limit in format Array ($offset, $count) * or only $count * @param string $columns Desired columns * @@ -858,7 +858,7 @@ public function update($tableName, $tableData, $numRows = null) * Delete query. Call the "where" method first. * * @param string $tableName The name of the database table to work with. - * @param int|array $numRows Array to define SQL limit in format Array ($count, $offset) + * @param int|array $numRows Array to define SQL limit in format Array ($offset, $count) * or only $count * * @return bool Indicates success. 0 or 1. @@ -1474,7 +1474,7 @@ private function _buildInsert($tableName, $insertData, $operation) * any passed update data, and the desired rows. * It then builds the SQL query. * - * @param int|array $numRows Array to define SQL limit in format Array ($count, $offset) + * @param int|array $numRows Array to define SQL limit in format Array ($offset, $count) * or only $count * @param array $tableData Should contain an array of data for updating the database. * @@ -1868,7 +1868,7 @@ protected function _buildOrderBy() /** * Abstraction method that will build the LIMIT part of the WHERE statement * - * @param int|array $numRows Array to define SQL limit in format Array ($count, $offset) + * @param int|array $numRows Array to define SQL limit in format Array ($offset, $count) * or only $count * * @return void From 04b2a29aad71044f695abd101c6368df49383848 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Wed, 2 Aug 2017 12:06:10 -0400 Subject: [PATCH 2/4] Expand readme on autoreconnect and multipe connections usage --- readme.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/readme.md b/readme.md index c780c6c4..8fcdb9ff 100644 --- a/readme.md +++ b/readme.md @@ -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 () { @@ -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 dbObject manual for more information From 0685cb052ddfd1ac65e5b9ef3f219ea35acfb030 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Wed, 2 Aug 2017 22:56:28 -0400 Subject: [PATCH 3/4] update release numbers --- MysqliDb.php | 2 +- dbObject.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MysqliDb.php b/MysqliDb.php index 1fa07a43..39e3049b 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -10,7 +10,7 @@ * @copyright Copyright (c) 2010-2016 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License * @link http://github.com/joshcam/PHP-MySQLi-Database-Class - * @version 2.8-master + * @version 2.9-master */ class MysqliDb diff --git a/dbObject.php b/dbObject.php index ea00efee..d891387e 100644 --- a/dbObject.php +++ b/dbObject.php @@ -8,7 +8,7 @@ * @copyright Copyright (c) 2015 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License * @link http://github.com/joshcam/PHP-MySQLi-Database-Class - * @version 2.6-master + * @version 2.9-master * * @method int count () * @method dbObject ArrayBuilder() From 2959ecb6000da5ef399f5b09e7a9055733d56231 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Wed, 2 Aug 2017 22:57:19 -0400 Subject: [PATCH 4/4] update copyright years --- MysqliDb.php | 2 +- dbObject.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MysqliDb.php b/MysqliDb.php index 39e3049b..1e2df454 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -7,7 +7,7 @@ * @author Jeffery Way * @author Josh Campbell * @author Alexander V. Butenko - * @copyright Copyright (c) 2010-2016 + * @copyright Copyright (c) 2010-2017 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License * @link http://github.com/joshcam/PHP-MySQLi-Database-Class * @version 2.9-master diff --git a/dbObject.php b/dbObject.php index d891387e..0da3881b 100644 --- a/dbObject.php +++ b/dbObject.php @@ -5,7 +5,7 @@ * @category Database Access * @package MysqliDb * @author Alexander V. Butenko - * @copyright Copyright (c) 2015 + * @copyright Copyright (c) 2015-2017 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License * @link http://github.com/joshcam/PHP-MySQLi-Database-Class * @version 2.9-master