From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/database/drivers/interbase/interbase_result.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/interbase/interbase_result.php') diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php index 4b15eee20..5bf0c902d 100644 --- a/system/database/drivers/interbase/interbase_result.php +++ b/system/database/drivers/interbase/interbase_result.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 60c9c9990f635309965929e73d0bfe52d46253ca Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:46:09 +0200 Subject: Some small improvements to CI_DB_interbase_result --- .../drivers/interbase/interbase_result.php | 85 +++++++++------------- 1 file changed, 34 insertions(+), 51 deletions(-) (limited to 'system/database/drivers/interbase/interbase_result.php') diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php index 5bf0c902d..fd4178dec 100644 --- a/system/database/drivers/interbase/interbase_result.php +++ b/system/database/drivers/interbase/interbase_result.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Interbase/Firebird Result Class * @@ -43,18 +41,18 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of rows in the result set * - * @return integer + * @return int */ public function num_rows() { - if( ! is_null($this->num_rows)) + if (is_int($this->num_rows)) { return $this->num_rows; } - - //Get the results so that you can get an accurate rowcount + + // Get the results so that you can get an accurate rowcount $this->result(); - + return $this->num_rows; } @@ -63,7 +61,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of fields in the result set * - * @return integer + * @return int */ public function num_fields() { @@ -102,20 +100,17 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function field_data() { - $retval = array(); - for ($i = 0, $num_fields = $this->num_fields(); $i < $num_fields; $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $info = ibase_field_info($this->result_id, $i); - - $F = new stdClass(); - $F->name = $info['name']; - $F->type = $info['type']; - $F->max_length = $info['length']; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; + + $retval[$i] = new stdClass(); + $retval[$i]->name = $info['name']; + $retval[$i]->type = $info['type']; + $retval[$i]->max_length = $info['length']; + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; } return $retval; @@ -126,7 +121,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ public function free_result() { @@ -138,7 +133,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * @@ -146,11 +141,8 @@ class CI_DB_interbase_result extends CI_DB_result { */ protected function _data_seek($n = 0) { - //Set the row count to 0 - $this->num_rows = 0; - - //Interbase driver doesn't implement a suitable function - return FALSE; + // Interbase driver doesn't implement a suitable function + return FALSE; } // -------------------------------------------------------------------- @@ -169,7 +161,7 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } @@ -189,10 +181,10 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } - + // -------------------------------------------------------------------- /** @@ -202,29 +194,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_object() { - if (count($this->result_object) > 0) + if (count($this->result_object) === $this->num_rows) { return $this->result_object; } - - // Convert result array to object so that + + // Convert result array to object so that // We don't have to get the result again - if (count($this->result_array) > 0) + if (($c = count($this->result_array)) > 0) { - $i = 0; - - foreach ($this->result_array as $array) + for ($i = 0; $i < $c; $i++) { - $this->result_object[$i] = new StdClass(); - - foreach ($array as $key => $val) - { - $this->result_object[$i]->{$key} = $val; - } - - ++$i; + $this->result_object[$i] = (object) $this->result_array[$i]; } - + return $this->result_object; } @@ -254,20 +237,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_array() { - if (count($this->result_array) > 0) + if (count($this->result_array) === $this->num_rows) { return $this->result_array; } - + // Since the object and array are really similar, just case // the result object to an array if need be - if (count($this->result_object) > 0) + if (($c = count($this->result_object)) > 0) { - foreach ($this->result_object as $obj) + for ($i = 0; $i < $c; $i++) { - $this->result_array[] = (array) $obj; + $this->result_array[$i] = (array) $this->result_object[$i]; } - + return $this->result_array; } -- cgit v1.2.3-24-g4f1b From 8f3566fffcb9015ba53dbf52922fc5724ffa6045 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 12 Apr 2012 14:30:05 +0300 Subject: Changed default CI_DB_result::_data_seek() return value to FALSE and removed the method from drivers that don't support it --- system/database/drivers/interbase/interbase_result.php | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'system/database/drivers/interbase/interbase_result.php') diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php index fd4178dec..5ddb6fa47 100644 --- a/system/database/drivers/interbase/interbase_result.php +++ b/system/database/drivers/interbase/interbase_result.php @@ -130,23 +130,6 @@ class CI_DB_interbase_result extends CI_DB_result { // -------------------------------------------------------------------- - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @return array - */ - protected function _data_seek($n = 0) - { - // Interbase driver doesn't implement a suitable function - return FALSE; - } - - // -------------------------------------------------------------------- - /** * Result - associative array * -- cgit v1.2.3-24-g4f1b