首先,这就是我要做的事情:
在我的库中的一个类中,我想计算搜索结果的总行数.该类使用由搜索结果的附属模型设置的选择对象.我现在的问题是,这个select()已经通过from()设置了所请求的列,但是为了简单地计算我想要选择id的行,因为网站必须具有高性能.我不能简单地更改对象的值,因为我在库中使用它并且变量受到保护.不幸的是,Zend没有mySql count命令的功能,我不想使用静态mySql代码,因为它可能是我们将来切换我们的数据库系统.
现在这是我的问题:
Zend_Select是否有可能更改所选列?
语境:
message有列from_user_id和to_user_id表格内容:
+-------------------------------------------------+--------------+------------+
| text | from_user_id | to_user_id |
+-------------------------------------------------+--------------+------------+
| Hi there! | 13 | 14 | <- Liara to Penelope
| Oh hi, how are you? | 14 | 13 | <- Penelope to Liara
| Fine, thanks for asking. How are you? | 13 | 14 | <- Liara to Penelope
| Could not be better! How are things over there? | 14 | 13 | …Run Code Online (Sandbox Code Playgroud)