【问题标题】:REGEXP query exception in doctrine教义中的 REGEXP 查询异常
【发布时间】:2018-08-04 13:21:42
【问题描述】:

我正在 Doctrine 中尝试 REGEXPhttps://stackoverflow.com/a/26195280/1179841 找到这种情况 WHERE CONCAT(",", setcolumn, ",") REGEXP ",(val1|val2|val3),"。我在config.yml 中添加了这个

orm:
    dql:
      string_functions:
        regexp: DoctrineExtensions\Query\Mysql\Regexp

但是我仍然收到错误:

[2/2] QueryException: [Syntax Error] line 0, col 790: Error: Expected =, , >, >=, !=, got 'REGEXP'

我在composer.json 中使用"beberlei/DoctrineExtensions": "1.0.*"。有什么想法吗?

【问题讨论】:

    标签: symfony doctrine dql


    【解决方案1】:

    你像WHERE REGEXP(CONCAT(",", setcolumn, ","), ",(val1|val2|val3),") = 1一样使用它

    【讨论】:

    • 谢谢。这是我的实际工作情况REGEXP(CONCAT(',', setColumn, ','), CONCAT(',(', comparedColumn, '),')) = 1
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-27
    • 2018-07-11
    相关资源
    最近更新 更多