From 1228fe27bc1f22838cd80c5fe33c37274faf0e24 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Jan 2013 01:30:09 +0100 Subject: Replace is_null() with === / !== NULL Exact same behavior, but faster. I also think it's more readable. --- system/database/DB_query_builder.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'system/database/DB_query_builder.php') diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index dc2c5e702..978fc6af7 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -644,7 +644,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { ? $this->_group_get_type('') : $this->_group_get_type($type); - if ( ! is_null($v)) + if ($v !== NULL) { if ($escape === TRUE) { @@ -1202,7 +1202,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function limit($value, $offset = FALSE) { - is_null($value) OR $this->qb_limit = (int) $value; + $value === NULL OR $this->qb_limit = (int) $value; empty($offset) OR $this->qb_offset = (int) $offset; return $this; @@ -1382,7 +1382,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $this->from($table); } - if ( ! is_null($where)) + if ($where !== NULL) { $this->where($where); } @@ -1411,7 +1411,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function insert_batch($table = '', $set = NULL, $escape = NULL) { - if ( ! is_null($set)) + if ($set !== NULL) { $this->set_insert_batch($set, '', $escape); } @@ -1567,7 +1567,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function insert($table = '', $set = NULL, $escape = NULL) { - if ( ! is_null($set)) + if ($set !== NULL) { $this->set($set, '', $escape); } @@ -1633,7 +1633,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function replace($table = '', $set = NULL) { - if ( ! is_null($set)) + if ($set !== NULL) { $this->set($set); } @@ -1742,7 +1742,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { // Combine any cached components with the current statements $this->_merge_cache(); - if ( ! is_null($set)) + if ($set !== NULL) { $this->set($set); } @@ -1815,12 +1815,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver { // Combine any cached components with the current statements $this->_merge_cache(); - if (is_null($index)) + if ($index === NULL) { return ($this->db_debug) ? $this->display_error('db_must_use_index') : FALSE; } - if ( ! is_null($set)) + if ($set !== NULL) { $this->set_update_batch($set, $index); } -- cgit v1.2.3-24-g4f1b From 912f1bcbc3d4f9b09695ab784d6985efbc4c9235 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 15 Jan 2013 03:34:12 +0100 Subject: A few adjustments to previous commit --- system/database/DB_query_builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_query_builder.php') diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 978fc6af7..ac377d996 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1202,7 +1202,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function limit($value, $offset = FALSE) { - $value === NULL OR $this->qb_limit = (int) $value; + is_null($value) OR $this->qb_limit = (int) $value; empty($offset) OR $this->qb_offset = (int) $offset; return $this; -- cgit v1.2.3-24-g4f1b