2008年10月1日星期三

Re: [fw-db] Zend_Db_Select & Oracle problem

This is how I have mine setup  for oracle and it works.

  $options = array(Zend_Db::AUTO_QUOTE_IDENTIFIERS => FALSE,
                       Zend_Db::CASE_UPPER );          
      $params  = array(
       'host'           => $config->database->params->host,
       'username'       => $config->database->params->username,
       'password'       => $config->database->params->password,
       'dbname'         => $config->database->params->dbname,
       'port'           => $config->database->params->port,
       'options'        => $options
     
         );            
       $db = Zend_Db::factory($config->database->adapter, $params);     



On Wed, Oct 1, 2008 at 1:24 PM, 411161 <411161@fedex.com> wrote:

I think I see however that brings up a few questions.

My config.ini looks like this:
[runzheimer]
db.adapter = PDO_OCI
db.config.host = vcp.web.fedex.com
db.config.username = runzheimer
db.config.password = runzheimer
db.config.dbname = vcpdb

Will my connection now have to look like it does below, or is there a way to
just incorporate the
Zend_Db::AUTO_QUOTE_IDENTIFIERS => true??



$options = array(
   Zend_Db::AUTO_QUOTE_IDENTIFIERS => false
);

$params = array(
   'host'           => '127.0.0.1',
   'username'       => 'webuser',
   'password'       => 'xxxxxxxx',
   'dbname'         => 'test',
   'options'        => $options
);

$db = Zend_Db::factory('Pdo_Mysql', $params);




411161 wrote:
>
> Not sure what I am doing wrong.
>
> //This works
> $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713';
> $this->view->result = $this->db->fetchAll($sql);
>
> //This does not
> //$select = $this->db->select()
> $select= $this->db->select()->from( 'runz_miles',
> 'EMPL_NO')->where('empl_no = ?', 31713);
> echo $select->__toString();
> //print_r($this->db->fetchAll($select));
> This gives me table does not exist.
>
> echo $select->__toString(); gives me:
> SELECT "runz_miles"."EMPL_NO" FROM "runz_miles" WHERE (empl_no = 31713)
> EMPL_NO should not be prefixed with runz_miles which is the table name.
>
> Here was my connection init()
>       function init(){
>
>               $config = new Zend_Config_Ini(APPLICATION_PATH . "/config.ini",
> "runzheimer");
>           $this->db = Zend_Db::factory($config->db->adapter,
> $config->db->config->toArray());
>               $this->db->getConnection();
>       }
>
>
>

--
View this message in context: http://www.nabble.com/Zend_Db_Select---Oracle-problem-tp19763934p19766386.html
Sent from the Zend DB mailing list archive at Nabble.com.


没有评论: