Skip to content

Commit 933b641

Browse files
authored
Merge pull request #2 from mckaygerhard/mckaygerhard-able-to-choose-database
Mckaygerhard able to choose database
2 parents a677b00 + 9b11bba commit 933b641

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ To install the library, copy the libraries/datatables.php file into your applica
1919

2020

2121
## Function Reference
22+
23+
### $this->setdb($database = 'default')
24+
Sets the name of the database configuration, if need another apart of default,
25+
The name of the database its optional.
26+
2227
Note: you can use method chaining for more compact syntax.
2328
### $this->datatables->select($columns);
2429
Sets which columns to fetch from the specified table.

application/libraries/Datatables.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ public function __construct()
3838
$this->ci =& get_instance();
3939
}
4040

41+
/**
42+
* Set a specific database event the default, if vopid reconnect the default
43+
*
44+
* @param string $databasename
45+
* @return void
46+
*/
47+
public function setdb($databasename = NULL)
48+
{
49+
if($databasename == NULL) $databasename = 'default';
50+
$this->ci->load->database($databasename);
51+
}
52+
53+
4154
/**
4255
* Generates the SELECT portion of the query
4356
*

0 commit comments

Comments
 (0)