Drupal 7使用视图添加页面SQL错误
我在 drupal 7 中有一个视图,我正在尝试添加另一个页面。我收到以下错误:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'data' at row 1: INSERT INTO {ctools_object_cache} (sid, obj, name, data, updated) VALUES ...etc...
对于存储的数据来说,blob 数据类型似乎太小...如果我将 ctools_object_cache->data 列更改为 LONGBLOB,它就可以工作。但这是解决这个问题的最好方法吗?
I have a view in drupal 7 where I am trying to add another page. I get the following error:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'data' at row 1: INSERT INTO {ctools_object_cache} (sid, obj, name, data, updated) VALUES ...etc...
It seems the blob data type is too small for the data being stored....If I change ctools_object_cache->data column to LONGBLOB, it works. But is this the best way to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您直接在数据库中更改字段架构,则在更新 ctools 模块时可能会遇到问题。如果 ctools 对该列进行任何更改,它最终可能会尝试使其变为旧大小,并且您最终可能会丢失数据。
除了更改数据库字段之外,最好修补
ctools_schema()
(在模块的.install
文件中)并将列更改为LONGBLOB那里。然后,当新版本的 ctools 出现时,您可以正常升级,并在需要时重新修补安装文件(请记住,此问题可能已在模块的问题队列中报告,并且可能已应用类似的修复在 ctools 模块的
update
挂钩中;您应该在更新之前查看新版本的.install
文件以确保。You could potentially run into problems when you update the ctools module if you just change the field schema directly in the database. If ctools makes any changes to that column it could end up trying to make it the old size and you may end up losing data.
As well as changing the database field it would be a good idea to patch
ctools_schema()
(in the module's.install
file) and change the column to aLONGBLOB
there. Then when a new version of ctools comes out you can upgrade as normal, and re-patch the install file if you need to (bear in mind that this issue may have been reported on the module's issue queue and a similar fix may have been applied in anupdate
hook in the ctools module; you should have a look at the.install
file of the new version before updating to make sure).