SELECT
date_add(audit_stop, INTERVAL audit_stop_usec MICROSECOND) as audit_stop,
date_add(audit_start, INTERVAL audit_start_usec MICROSECOND) AS
audit_start
FROM shows_audit, artists
WHERE ref_artist = artist_key
AND shows_key = $shows_key
ORDER BY audit_stop ASC, audit_start ASC, audit_stop_usec asc,
audit_start_usec asc
This is represented using zend_db_select and zend_db_expr as
$sql = $db->select()
->from('shows_audit', array(
new Zend_Db_Expr('date_add(audit_stop, INTERVAL audit_stop_usec
MICROSECOND) as audit_stop'),
new Zend_Db_Expr('date_add(audit_start, INTERVAL audit_start_usec
MICROSECOND) AS audit_start')
))
->from('artists', array())
->where("ref_artist = artist_key AND shows_key = $shows_key")
->order(array('audit_stop ASC', 'audit_start ASC', 'audit_stop_usec
ASC', 'audit_start_usec ASC'));
Under both conditions the date_add doesn't return the correct expression and
the usec's are lost. This query works fine under Pear. I suspect the root
cause is MySQL corrupts the function in it's prepare step but I'm posting
here since it's happening through Zend and I don't know a way around it.
Thank you,
Tom Anderson
--
View this message in context: http://old.nabble.com/MySQL-date_add-failes-under-Zend_Db-tp26294429p26294429.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论