Home » Internationalization » Translation2 » Bug #8915
Fetching vom Database does not work with Oracle
Details
| Submitted | 2006-10-09 09:09 UTC |
|---|---|
| From | d dot schwarz at lise dot de |
| Assigned | quipo |
| Status | Closed |
| Package | Translation2 |
| PHP Version | 5.0.4 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2006-10-09 09:09 UTC] d dot schwarz at lise dot de
Description:
------------
Since Oracle uses uppercase column-namens i had to change some Indeses from ['id'] to ['ID'] in the container classes to work.
Strange, but this little change helped in my situation
Test script:
---------------
// example for changed fetchLangs function in db.php-Container
// }}}
// {{{ fetchLangs()
/**
* Fetch the available langs if they're not cached yet.
*/
function fetchLangs()
{
$query = sprintf('SELECT %s AS id, %s AS name, %s AS meta, %s AS error_text, %s AS encoding FROM %s',
$this->db->quoteIdentifier($this->options['lang_id_col']),
$this->db->quoteIdentifier($this->options['lang_name_col']),
$this->db->quoteIdentifier($this->options['lang_meta_col']),
$this->db->quoteIdentifier($this->options['lang_errmsg_col']),
$this->db->quoteIdentifier($this->options['lang_encoding_col']),
$this->db->quoteIdentifier($this->options['langs_avail_table'])
);
++$this->_queries;
$res = $this->db->getAll($query, DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
return $res;
}
foreach ($res as $row) {
$this->langs[$row['ID']] = $row;
}
}
Expected result:
----------------
it works :-)
otherwise i allways get "object #resourceId"
[2006-10-09 10:58 UTC] d dot schwarz at lise dot de
...
$db = DB::connect("oci8://lise:PASSWORD@MYDB");
$query = 'SELECT id AS aliasname FROM langs_avail';
$row = $db->getRow($query, DB_FETCHMODE_ASSOC);
print_r(array_keys($row));
?>
results in
Array ( [0] => ALIASNAME )
really! :-)
if you use another application to confirm this (e. g. toad), you get the same result: uppercased aliasnames.