Zend_Db_Table_Rowset:使用 JOINS 时如何获取表信息(元数据)?
我想知道是否有人知道在生成该结果集的查询中使用联接时如何从 Zend_Db_Table_Rowset 类获取元数据信息?当不涉及联接时,这很容易......例如:
foreach ($rowset as $row) {
$info = $row->getTable()->info(Zend_Db_Table_Abstract::METADATA);
Zend_Debug::dump($info); // outputs array of column info including data type
}
但是当我对来自使用联接的查询的行执行此操作时,我只是从我选择的主表中获取数据......
I was wondering if anyone knew how to get the metadata info from a Zend_Db_Table_Rowset class when using joins in the query that produced that result set? It's easy when there are no joins involved.. for example:
foreach ($rowset as $row) {
$info = $row->getTable()->info(Zend_Db_Table_Abstract::METADATA);
Zend_Debug::dump($info); // outputs array of column info including data type
}
But when I do that to a row that came from a query using joins I just get the data from the main table I was selecting from..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jose,您需要什么样的元数据信息?也许有另一种方法可以实现你想要的。由于连接总是从一个表完成(并且您将其连接到其他表),我认为您将始终获得第一个表的元数据信息。
您是否有机会进行动态连接?
Jose, what kind of metadada info do you need? Maybe there is an alternate way to achieve what you want. Since the joins are always done from one table (and you join it to others) I think you will always get the metadata info for the first one.
By any chance are you doing dynamic joins?