Like this:
[runzheimer]
db.adapter = PDO_OCI
db.params.host = vcp.web.fedex.com
db.params.username = runzheimer
db.params.password = runzheimer
db.params.dbname = vcpdb
db.params.options.autoQuoteIdentifiers = false
You can use 'params' instead of 'config' to be able to do like this:
$db = Zend_Db::factory($my_zend_config_object);
See http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.factory-config
Mickael
411161 a écrit :
> 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();
>> }
>>
>>
>>
>>
>
>
没有评论:
发表评论