I'm upgrading my fuel app, I've hit an issue with my custom OCI DB driver, I did have to refactor it slightly, but the structure of the result object does not appear to have changed between the old codebase & new
object(Fuel\Core\Database_OCI_Result)#85 (8) {
["_query":protected]=>
string(538) "SELECT
`omitted`
["_result":protected]=>
array(1) {
[0]=>
object(stdClass)#56 (29) {
["id"]=>
string(8) "test"
}
}
["_results":protected]=>
NULL
["_row":protected]=>
NULL
["_total_rows":protected]=>
int(1)
["_current_row":protected]=>
int(-1)
["_as_object":protected]=>
bool(true)
["_sanitization_enabled":protected]=>
bool(false)
}
Why can't I access this data via $data[0] ? -this worked previously
If I loop through the single array index, it will work, but I can't manually access it via the above
Error [ Error ]: Cannot use object of type Fuel\Core\Database_OCI_Result as array
I can't look into your code, but there are two result objects: a standard one, and a cached one.
The standard one doesn't cache anything, but simply fetches the next row from the result as you iterate over it. This implies there is no random access, you can only loop once, start to finish.
The cached one, as its name implies, fetches all rows at one and stores it internally. This means random access is possible. To to that, it implements SeekableIterator and ArrayAccess.
If you come from an older Fuel version, you might have to update your code as quite a bit has changed here. Look at the PDO 'cached.php' and 'result.php' files for reference.