summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-14 11:17:13 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-14 11:17:13 +0100
commitbb8a68344931fc4621b8c3a173a7dcd572890fd8 (patch)
treee6dfe8dd2405b3c85051343bf823dc98fab94cd4
parent378e71e478e339ce61490083ab4951cabf9ccc2f (diff)
Fix issue #81
-rw-r--r--system/database/drivers/odbc/odbc_result.php22
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 15 insertions, 8 deletions
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 06d99226e..320b9327c 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -67,13 +67,19 @@ class CI_DB_odbc_result extends CI_DB_result {
*/
public function list_fields()
{
- $field_names = array();
- for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
+ $num_fields = $this->num_fields();
+ if ($num_fields > 0)
{
- $field_names[] = odbc_field_name($this->result_id, $i);
+ $field_names = array();
+ for ($i = 1; $i <= $num_fields; $i++)
+ {
+ $field_names[] = odbc_field_name($this->result_id, $i);
+ }
+
+ return $field_names;
}
- return $field_names;
+ return array();
}
// --------------------------------------------------------------------
@@ -88,12 +94,12 @@ class CI_DB_odbc_result extends CI_DB_result {
public function field_data()
{
$retval = array();
- for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
+ for ($i = 0, $odbc_index = 1, $c = $this->num_fields(); $i < $c; $i++, $odbc_index++)
{
$retval[$i] = new stdClass();
- $retval[$i]->name = odbc_field_name($this->result_id, $i);
- $retval[$i]->type = odbc_field_type($this->result_id, $i);
- $retval[$i]->max_length = odbc_field_len($this->result_id, $i);
+ $retval[$i]->name = odbc_field_name($this->result_id, $odbc_index);
+ $retval[$i]->type = odbc_field_type($this->result_id, $odbc_index);
+ $retval[$i]->max_length = odbc_field_len($this->result_id, $odbc_index);
$retval[$i]->primary_key = 0;
$retval[$i]->default = '';
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 93348566c..e08f3be89 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -106,6 +106,7 @@ Bug fixes for 3.0
- Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to 'on'
- Fixed a bug (#154) - ``CI_Session::sess_update()`` caused the session to be destroyed on pages where multiple AJAX requests were executed at once.
- Fixed a possible bug in ``CI_Input::is_ajax_request()`` where some clients might not send the X-Requested-With HTTP header value exactly as 'XmlHttpRequest'.
+- Fixed a bug (#81) - ODBC's list_field() and field_data() methods skipped the first column due to odbc_field_*() functions' index starting at 1 instead of 0.
Version 2.1.0
=============