// inside your table class
$columns = array(
'someColumn',
'ASTEXT(blobColumn)'
);
$select = $this->select()
->from($this, $columns);
return $this->fetchAll($select);
On Fri, Aug 14, 2009 at 12:45 PM, andeeh<andyh@alh.me.uk> wrote:
>
> Hi All,
>
> I'm working on my data model and extending Zend_Db_Table. I really like the
> fact that I can be up and running quickly as the structure of underlying
> table is being automatically read. When doing INSERT or UPDATE operations
> I've been able to apply SQL functions via Zend_Db_Expr (overriding "_update"
> and "_delete" methods in Zend_Db_Table_Row_Abstract).
>
> I'm wondering, if I use the fetchall() method of Zend_Db_Table, what is the
> correct way of applying SQL functions? For example, one of the columns is a
> BLOB and it's coming out of my database directly without any transformation.
> I need to apply the function ASTEXT() in the SELECT statement. Is there a
> way to tweak a Zend_Db_Table to register SQL functions for specific columns?
> I'm not entirely sure how to do this. I'm using Postgres, but I don't think
> it matters, I just need to tweak the table so it always selects the blob
> column with the ASTEXT() function.
>
> regards,
> andy
>
> --
> View this message in context: http://www.nabble.com/Zend_Db_Table%2C-fetching-records-using-SQL-functions-tp24975823p24975823.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>
>
没有评论:
发表评论