Drupal - 为什么“从节点节点”在视图中的 SQL 查询中?
好吧...我正在深入研究 Drupal 的内部,试图了解里面到底发生了什么:)
我确信这是一个可笑的愚蠢问题,但是当我创建一个节点视图时,为什么SQL 查询“SELECT [....] FROM node 节点”而不仅仅是“SELECT [....] FROM node” 第二个“节点”表示什么?
干杯, 詹姆斯
OK... I'm delving into the bowels of Drupal in an effort to understand just what the hell is going on in there :)
I'm sure this is a ridiculously silly question, but when I create a node view why is the SQL query 'SELECT [....] FROM node node' and not just 'SELECT [....] FROM node' What does the second 'node' signify?
Cheers,
James
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 brian_d 所说,第二次出现的
node
是查询中使用的表的别名。可能(尽管我不确定)别名是作为经过清理的标识符生成的,以防实际的表名称像Star$Linked_System:username:[电子邮件受保护]:3306:/some/insane;文件系统
。对于像
node
这样的好名字,清理后的版本与原始版本相同。As brian_d says, the second occurrence of
node
is the table's alias for use in the query. It might be (though I don't know for sure) that the alias is generated as a sanitized identifier in case the actual table name is something unwieldy likeStar$Linked_System:username:[email protected]:3306:/some/insane;filesystem
.For a nice name like
node
, the sanitized version is the same as the original.“node节点”是表别名,它恰好与查询中的真实表名称相同。别名用于 JOIN 语句。
我猜测 drupal 即使不需要它也会生成别名。
"node node" is the table alias, which happens to be identical to the real table name in your query. Aliases are used for JOIN statements.
I am guessing that drupal generates the alias even when it is not needed.