douan2478 2011-04-14 17:16
浏览 40
已采纳

我是否应该能够使用文本值更新MySQL枚举类型?

I'm trying to update the value in a MYSQL enum field from PHP via Doctrine (5.3 and 1.2 respectively).

I get an error when I try and do this:

    $q = Doctrine_Query::create()
            ->update('StMessages')
            ->set('status','new')
            ->where('message_id = ?',$msg_id);

I get a sql state error telling me that the column 'new' does not exist. If I enter 3 instead of new (presumably the internal index of the 'new' value), then the query works. In fact it happens in a SQL client too so perhaps this is a quirk of this version of MySQL? Its 5.1.45.

Anyone know if this is how MySQL is supposed to treat enums or if this is more likely a Doctrine issue? I have 'use_native_enum' set to true.

  • 写回答

2条回答 默认 最新

  • dou91808 2011-04-18 13:43
    关注

    I think this was actually an issue relating to the quoting of strings when updating the field's values. I'm not sure if Doctrine or I was at fault.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器