通过 Zend_Db_Rowset 提取查询部分
我正在构建一个仅通过其参数接收 Zend_Db_Rowset
的类,并且我可以使用 $rowset->getTable()< 从中提取相关的
Zend_Db_Table
/代码> 方法。
我想知道是否有办法从表中获取 order
语句,因为我可以通过转储将其设置(作为私有属性)。
object(Application_Model_DbTable_View_Formation)#107 (18) {
...
["_rows":protected] => array(4) {
[0] => array(3) {
[0] => string(7) "0.04095"
[1] => string(20) "DESCRIBE `formation`"
[2] => NULL
}
[1] => array(3) {
[0] => string(7) "0.00047"
[1] => string(67) "SELECT `formation`.* FROM `formation` ORDER BY `date` desc LIMIT 30"
[2] => NULL
}
[2] => array(3) {
[0] => string(7) "0.02031"
[1] => string(22) "DESCRIBE `v_formation`"
[2] => NULL
}
[3] => array(3) {
[0] => string(7) "0.02285"
[1] => string(135) "SELECT `v_formation`.* FROM `v_formation` WHERE (date >= '2011-01-01 12:00:00') AND (date <= '2011-12-31 11:59:59') ORDER BY `date` ASC"
[2] => NULL
}
}
...
}
I am building a class that only receive a Zend_Db_Rowset
throught its params and from that I can extract the related Zend_Db_Table
using the $rowset->getTable()
method.
I was wondering if there is a way to get the order
statement back from the table since I can set it (as a private property) through a dump.
object(Application_Model_DbTable_View_Formation)#107 (18) {
...
["_rows":protected] => array(4) {
[0] => array(3) {
[0] => string(7) "0.04095"
[1] => string(20) "DESCRIBE `formation`"
[2] => NULL
}
[1] => array(3) {
[0] => string(7) "0.00047"
[1] => string(67) "SELECT `formation`.* FROM `formation` ORDER BY `date` desc LIMIT 30"
[2] => NULL
}
[2] => array(3) {
[0] => string(7) "0.02031"
[1] => string(22) "DESCRIBE `v_formation`"
[2] => NULL
}
[3] => array(3) {
[0] => string(7) "0.02285"
[1] => string(135) "SELECT `v_formation`.* FROM `v_formation` WHERE (date >= '2011-01-01 12:00:00') AND (date <= '2011-12-31 11:59:59') ORDER BY `date` ASC"
[2] => NULL
}
}
...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您看到的是 Zend_Db_Profiler 数据。这与实际的行集无关。我认为您无法获得创建该行集的选择。
严格来说桌子的顺序。您本身无法接收它。您只能使用 public
$table->select()->order('id DESC');
方法创建带顺序的选择。What you see is Zend_Db_Profiler data. This has no relation to the actual rowset. I think you can't get the select that created that rowset.
Speaking strictly about the order for the table. You can't receive it per-se. You can only create a select with order using public
$table->select()->order('id DESC');
method.