2008年10月1日星期三

[fw-db] Zend_Db_Select & Oracle problem

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-tp19763934p19763934.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: