通过Zend_Db_Rowset提取查询部分


Extracting query parts through 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
      }
    }
   ...
}

您看到的是Zend_Db_Profiler数据。这与实际的行集没有关系。我认为你无法获得创建行集的select。

严格地讲桌子的顺序。你不能接收它本身。您只能使用public $table->select()->order('id DESC');方法创建带有order的select。