CodeIgniter
CodeIgniter copied to clipboard
oci8 returns OCI-Lob objects
I'm using CI 3.1.10 and when I run a get against a database with the oci8 driver I have to manualy run ->load() against OCI-Lob objects.
I think this is a bug because DB_result must be driver-agnostic and this exposes how oci8 works.
Maybe can be an option to expose this beauvoir.
Also breaks the database session driver
I'm sorry, I haven't had access to an Oracle database in years and I can't test this. However, patches to the oci8 driver were my first contributions to CI and I would definitely remember a problem like this, so I must assume you're talking of something way more isolated than what it sounds like by your description - please provide an example.
Also, the session driver doesn't support oci8 and this is documented.
If there is a CLOB column is not returned as a string but as a OCI
I'm using an helper to workaround the issue
if (!function_exists('oci8_fix_result_array')) {
function oci8_fix_result_array($data) {
if (!is_null($data)) {
foreach ($data as $ext_key => $item) {
foreach ($item as $key => $value) {
if (is_object($value) && get_class($value) == "OCI-Lob") {
$data[$ext_key][$key] = $value->load();
}
}
}
}
return $data;
}
}
Isn't good code but it works.
The session on oracle works with "data" varchar2(4000 BYTE) NULL in the schema
I see ... We've not paid any attention to LOBs indeed. This isn't exactly a bug, more like an unsupported feature due to our aim to support as many DB platoforms as possible - we don't implement features that only exist in one or two of them, because you're otherwise screwed in case you try to migrate to a database that doesn't have the feature in question.
In this case I think we can implement it regardless of that concern, but it also has to work in PDO_OCI. I found this link suggesting that we'd use stream_get_contents() (relying on an is_resource() check) or PDO::STRINGIFY_FETCHES there. Have you tried that or can you test it?
As for the sessions, again - Oracle is not supported; we only support MySQL and PostgreSQL there, due to advisory locks availability. It may appear to work, but it's not locking current state, which means concurrency problems and possible data corruption. In hindsight, I should've made it to throw an exception in case someone tries to use another database. Maybe I'll change that for 3.2.0.
Unfortunately I can only test oci8 driver and not the PDO one, seems to me that they PDO OCI8 driver is no longer maintained and I can't get it to work on my setup.
OK, I guess we'll have to rely purely on its documentation then. However, this will also have to target 3.2.0 due to BC concerns.