最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】user warning: Table ‘XXX.annotations’ doesn’t exist query: SELECT note FROM annotations WHERE nid = XXX AND uid = 1 in XXXsitesallmodulescustomannotate.module on line XXX

Drupal crifan 1691浏览 0评论

【已解决】user warning: Table ‘XXX.annotations’ doesn’t exist query: SELECT note FROM annotations WHERE nid = XXX AND uid = 1 in XXXsitesallmodulescustomannotate.module  on line XXX

【背景】

按照Pro Drupal Development Second Edition (Drupal 6)去学习新建一个annotate的模块,前面都很顺利,但是最后新建一个page,点击save后,出现annotate的时候,结果显示错误:

user warning: Table ‘mysql_drupal6.annotations’ doesn’t exist query: SELECT note FROM annotations WHERE nid = 12 AND uid = 1 in E:DrupalApache_rootApache Software FoundationApache2.2htdocsdrupal6sitesallmodulescustomannotateannotate.module on line 87.
【解决过程】
1. 网上找了半天,其他也有遇到类似问题的:
Pro Drupal Development Chapter 2: annotate

http://drupal.org/node/346632

但是貌似也没有提供解决办法。

2. 后来找到这里:

http://drupal.org/node/323065

才提到了具体的原因,至少知道了,当前的代码的函数用错了。

而且该书官网:

http://www.drupalbook.com/errata_overview

中,drupal 6的勘误表:
里面提到了这个错误:
“Error: 

variable_delete(‘annotate_node_types’);

Correction: 

variable_del(‘annotate_node_types’);”

对照代码,我的手上的代码,是从:

http://www.17drupal.com/node/141

拷贝过来的,是variable_delete了。

然后去这里:

http://www.drupalbook.com/node/2

下载了官方代码,其中的函数用的是variable_del,的确是工作正常的。

然后经过测试,此处用了错误的variable_delete,机会导致的后面一系列的问题,即:

(1)卸载annotate的时候,也会出现500的网页错误

(2)然后重新去enable这个模块的时候,也无法生成对应的数据库的项

(3)然后创建一个page,去测试annotate的时候,就会出现上面那个“doesn’t exist query”的错误。

【总结】
所以,整个的所有的错误,其实就是由于原先的代码中,函数名字写错了,解决办法就是:
variable_delete改为variable_del即可,如此而已。

转载请注明:在路上 » 【已解决】user warning: Table ‘XXX.annotations’ doesn’t exist query: SELECT note FROM annotations WHERE nid = XXX AND uid = 1 in XXXsitesallmodulescustomannotate.module on line XXX

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
81 queries in 0.157 seconds, using 21.97MB memory