Skip to content

Commit

Permalink
Fixed bug - using field_data() on Oracle databases
Browse files Browse the repository at this point in the history
When you're using oracle databases and want to retrieve column information through the function field_data($table) you get the following notice: 

- Notice: Undefined property: stdClass::$COLUMN_DEFAULT in system/database/drivers/oci8/oci8_driver.php on line 576;

This happens because the oci8 driver tries to access a property that does not exist on query used to get field information. Checking the code we see a small validation to set default value, but the variable $default is not used. So we fix this bug by simply changing:

$retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
to 
$retval[$i]->default = $default;

Bug fixed. No more notices and the properly value is set.
  • Loading branch information
leandrowkz committed May 13, 2015
1 parent 7d19161 commit 4c08ea9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion system/database/drivers/oci8/oci8_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function field_data($table)
{
$default = '';
}
$retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
$retval[$i]->default = $default;
}

return $retval;
Expand Down

0 comments on commit 4c08ea9

Please sign in to comment.