summaryrefslogtreecommitdiffstats
path: root/system
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 /system
parent378e71e478e339ce61490083ab4951cabf9ccc2f (diff)
Fix issue #81
Diffstat (limited to 'system')
-rw-r--r--system/database/drivers/odbc/odbc_result.php22
1 files changed, 14 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 = '';
}