@@ -211,8 +211,8 @@ protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
211211 $ alias = $ this ->_create_alias_from_table (trim ($ select ));
212212 }
213213
214- $ sql = $ this ->protect_identifiers ($ type .'( ' .trim ($ select ).') ' ).' AS ' .$ this ->protect_identifiers (trim ($ alias ));
215-
214+ $ sql = $ this ->protect_identifiers ($ type .'( ' .trim ($ select ).') ' ).' AS ' .$ this ->escape_identifiers (trim ($ alias ));
215+
216216 $ this ->qb_select [] = $ sql ;
217217 $ this ->qb_no_escape [] = NULL ;
218218
@@ -256,7 +256,7 @@ protected function _create_alias_from_table($item)
256256 */
257257 public function distinct ($ val = TRUE )
258258 {
259- $ this ->qb_distinct = ( is_bool ($ val) ) ? $ val : TRUE ;
259+ $ this ->qb_distinct = is_bool ($ val ) ? $ val : TRUE ;
260260 return $ this ;
261261 }
262262
@@ -272,7 +272,7 @@ public function distinct($val = TRUE)
272272 */
273273 public function from ($ from )
274274 {
275- foreach ((array )$ from as $ val )
275+ foreach ((array ) $ from as $ val )
276276 {
277277 if (strpos ($ val , ', ' ) !== FALSE )
278278 {
@@ -1111,6 +1111,8 @@ public function get($table = '', $limit = null, $offset = null)
11111111 return $ result ;
11121112 }
11131113
1114+ // --------------------------------------------------------------------
1115+
11141116 /**
11151117 * "Count All Results" query
11161118 *
@@ -1139,6 +1141,7 @@ public function count_all_results($table = '')
11391141 $ row = $ result ->row ();
11401142 return (int ) $ row ->numrows ;
11411143 }
1144+
11421145 // --------------------------------------------------------------------
11431146
11441147 /**
@@ -1401,16 +1404,13 @@ protected function _validate_insert($table = '')
14011404 return ($ this ->db_debug ) ? $ this ->display_error ('db_must_use_set ' ) : FALSE ;
14021405 }
14031406
1404- if ($ table = = '' )
1407+ if ($ table ! = '' )
14051408 {
1406- if ( ! isset ($ this ->qb_from [0 ]))
1407- {
1408- return ($ this ->db_debug ) ? $ this ->display_error ('db_must_set_table ' ) : FALSE ;
1409- }
1409+ $ this ->qb_from [0 ] = $ table ;
14101410 }
1411- else
1411+ elseif ( ! isset ( $ this -> qb_from [ 0 ]))
14121412 {
1413- $ this ->qb_from [ 0 ] = $ table ;
1413+ return ( $ this ->db_debug ) ? $ this -> display_error ( ' db_must_set_table ' ) : FALSE ;
14141414 }
14151415
14161416 return TRUE ;
@@ -1600,16 +1600,13 @@ protected function _validate_update($table = '')
16001600 return ($ this ->db_debug ) ? $ this ->display_error ('db_must_use_set ' ) : FALSE ;
16011601 }
16021602
1603- if ($ table = = '' )
1603+ if ($ table ! = '' )
16041604 {
1605- if ( ! isset ($ this ->qb_from [0 ]))
1606- {
1607- return ($ this ->db_debug ) ? $ this ->display_error ('db_must_set_table ' ) : FALSE ;
1608- }
1605+ $ this ->qb_from [0 ] = $ table ;
16091606 }
1610- else
1607+ elseif ( ! isset ( $ this -> qb_from [ 0 ]))
16111608 {
1612- $ this ->qb_from [ 0 ] = $ table ;
1609+ return ( $ this ->db_debug ) ? $ this -> display_error ( ' db_must_set_table ' ) : FALSE ;
16131610 }
16141611
16151612 return TRUE ;
@@ -1696,15 +1693,11 @@ public function set_update_batch($key, $index = '', $escape = TRUE)
16961693 {
16971694 $ index_set = TRUE ;
16981695 }
1699- else
1700- {
1701- $ not [] = $ k .'- ' .$ v ;
1702- }
17031696
17041697 $ clean [$ this ->protect_identifiers ($ k2 )] = ($ escape === FALSE ) ? $ v2 : $ this ->escape ($ v2 );
17051698 }
17061699
1707- if ($ index_set == FALSE )
1700+ if ($ index_set === FALSE )
17081701 {
17091702 return $ this ->display_error ('db_batch_missing_index ' );
17101703 }
@@ -2102,7 +2095,7 @@ protected function _compile_select($select_override = FALSE)
21022095 * @param object
21032096 * @return array
21042097 */
2105- public function _object_to_array ($ object )
2098+ protected function _object_to_array ($ object )
21062099 {
21072100 if ( ! is_object ($ object ))
21082101 {
@@ -2132,7 +2125,7 @@ public function _object_to_array($object)
21322125 * @param object
21332126 * @return array
21342127 */
2135- public function _object_to_array_batch ($ object )
2128+ protected function _object_to_array_batch ($ object )
21362129 {
21372130 if ( ! is_object ($ object ))
21382131 {
0 commit comments