@@ -19,22 +19,11 @@ class MY_Model extends CI_Model
19
19
* guessed by pluralising the model name.
20
20
*/
21
21
protected $ _table ;
22
-
23
- /**
24
- * Specify a database group to manually connect this model
25
- * to the specified DB. You can pass either the group name
26
- * as defined in application/config/database.php, or a
27
- * config array of the same format (basically the same thing
28
- * you can pass to $this->load->database()). If left empty,
29
- * the default DB will be used.
30
- */
31
- protected $ _db_group ;
32
22
33
23
/**
34
24
* The database connection object. Will be set to the default
35
- * connection unless $this->_db_group is specified. This allows
36
- * individual models to use different DBs without overwriting
37
- * CI's global $this->db connection.
25
+ * connection. This allows individual models to use different DBs
26
+ * without overwriting CI's global $this->db connection.
38
27
*/
39
28
public $ _database ;
40
29
@@ -114,8 +103,8 @@ public function __construct()
114
103
115
104
$ this ->load ->helper ('inflector ' );
116
105
117
- $ this ->_set_database ();
118
106
$ this ->_fetch_table ();
107
+ $ this ->_database = $ this ->db ;
119
108
120
109
array_unshift ($ this ->before_create , 'protect_attributes ' );
121
110
array_unshift ($ this ->before_update , 'protect_attributes ' );
@@ -878,29 +867,6 @@ private function _fetch_table()
878
867
}
879
868
}
880
869
881
- /**
882
- * Establish the database connection.
883
- */
884
- private function _set_database ()
885
- {
886
- // Was a DB group specified by the user?
887
- if ($ this ->_db_group !== NULL )
888
- {
889
- $ this ->_database = $ this ->load ->database ($ this ->_db_group , TRUE , TRUE );
890
- }
891
- // No DB group specified, use the default connection.
892
- else
893
- {
894
- // Has the default connection been loaded yet?
895
- if ( ! isset ($ this ->db ) OR ! is_object ($ this ->db ))
896
- {
897
- $ this ->load ->database ('' , FALSE , TRUE );
898
- }
899
-
900
- $ this ->_database = $ this ->db ;
901
- }
902
- }
903
-
904
870
/**
905
871
* Set WHERE parameters, cleverly
906
872
*/
0 commit comments