mybatis中写sql语句时需要转义的字符


mybatis配置文件,sql语句中含有转义字符:

错误语句:

  select * from table_base where flag_topic  & #{topic_num}

错误信息:

  Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 54; The entity name must immediately follow the '&' in the entity reference.

正确语句:

  select * from table_base where flag_topic   & #{topic_num}

将语句中的位运算(与)”&“符使用“&”替换

mybatis配置文件写SQL语句的某些字符需要转义:

  &lt;          < 
    &gt;          >  
    &lt;&gt;   <>
    &amp;      & 
    &apos;      '
    &quot;      "

注意:要加上分号!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM