Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.4

Bug #8915 Fetching vom Database does not work with Oracle
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)    
Subscription  


 [2006-10-09 09:09 UTC] d dot schwarz at lise dot de (Daniel Schwarz)
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"

Comments

 [2006-10-09 10:42 UTC] quipo (Lorenzo Alberton)
//Does Oracle uppercase the ALIAS? $query = 'SELECT colname AS aliasname FROM tablename'; $row = $db->getRow($query, DB_FETCHMODE_ASSOC); print_r(array_keys($row)); //should print "aliasname", not "ALIASNAME". Can anyone confirm this?
 [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.
 [2006-10-09 15:16 UTC] quipo (Lorenzo Alberton)
Ok, I've committed a fix to CVS. Until the next release, you can set this option in your DB instance: $db->options['portability'] = DB_PORTABILITY_LOWERCASE;