简体   繁体   English

发生异常:列不能为NULL

[英]Exception Occurred: Column cannot be NULL

I have been pulling my hair out on this one. 我一直在拉我的头发。 I am getting this error: 我收到此错误:

Exception Occurred: /homepages/22/d734597661/htdocs/clickandbuilds/concrete/MyCMS/updates/concrete5-8.4.2/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:112 An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive, cIsDraft) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["461", null, "12", null, "1", "TEMPLATE", null, 210, 0, 0, 0, 1]: 发生异常:/homepages/22/d734597661/htdocs/clickandbuilds/concrete/MyCMS/updates/concrete5-8.4.2/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:112发生异常在执行'插入页面(cID,siteTreeID,ptID,cParentID,uID,cInheritPermissionsFrom,cOverrideTemplatePermissions,cInheritPermissionsFromCID,cDisplayOrder,pkgID,cIsActive,cIsDraft)值时,?,?,?)'和params [“ 461”,null,“ 12”,null,“ 1”,“ TEMPLATE”,null,210、0、0、0、1]:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cOverrideTemplatePermissions' cannot be null (0) SQLSTATE [23000]:违反完整性约束:1048列'cOverrideTemplatePermissions'不能为null(0)

Here is the code: 这是代码:

        case '2005':
            return new Exception\ConnectionException($message, $exception);

        case '1048':
        case '1121':
        case '1138':
        case '1171':
        case '1252':
        case '1263':
        case '1566':
            return new Exception\NotNullConstraintViolationException($message, $exception);
    }

    return new Exception\DriverException($message, $exception);
}

/**
 * {@inheritdoc}
 */
public function createDatabasePlatformForVersion($version)
{
    if ( ! preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) {

This is breaking my web site. 这破坏了我的网站。 I would be very grateful if anyone has seen this before and could tell me what to do. 如果有人以前见过此事并可以告诉我该怎么办,我将不胜感激。 I am lost. 我搞不清楚了。 I understand it's a mysql error. 我了解这是mysql错误。 The error is generated from this line: 错误是从此行生成的:

return new Exception\NotNullConstraintViolationException($message, $exception);

This is a core issue in Concrete5, and nothing you should be looking to fix manually. 这是Concrete5中的核心问题,不需要手动修复任何内容。

Your best option for solving this is discussing with the Concrete5 developers on their Slack channel or opening a bug report on their github repo . 解决此问题的最佳选择是在其Slack频道上与Concrete5开发人员讨论,或在其github存储库上打开错误报告

If you are able to fix this on your own in the referenced file, the next time you update Concrete5 it will just break again. 如果您能够在参考文件中自行修复此问题,则下次更新Concrete5时,它将再次中断。

Concrete5 does allow overrides of most files, but with issues like this that are core functionality it's usually best to rely on the Concrete5 team to fix the issue and push out an update. Concrete5确实允许覆盖大多数文件,但是对于像这样的问题,它们是核心功能,通常最好依靠Concrete5团队来解决问题并推出更新。

All that said, it might be possible to troubleshoot more, but you have to share what you're doing when this error occurs: 综上所述,可能有可能对更多的问题进行故障排除,但是在发生此错误时,您必须共享正在执行的操作:

  • Are you just loading a page? 您是否正在加载页面?
  • Editing it? 编辑吗?
  • Changing a template? 更改模板?

Finally, the first thing I always do in Concrete5 is clear the cache . 最后,我在Concrete5中经常要做的第一件事就是清除cache If that doesn't work you can always try recreating the page causing the issue, since some older bugs in Concrete5 can persist through database consistency issues after upgrading to newer versions. 如果这样不起作用,则可以始终尝试重新创建导致该问题的页面,因为在升级到较新版本后,Concrete5中的某些较旧的错误可能会由于数据库一致性问题而持续存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM