通过 Zend_Db_Rowset 提取查询部分

发布于 2024-11-25 05:20:13 字数 1125 浏览 4 评论 0原文

我正在构建一个仅通过其参数接收 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁的年少不轻狂 2024-12-02 05:20:13

您看到的是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文