Because the XML format, "<", ">" and other symbols can not be casually appear, so in SQL this kind of symbols to be special processing
The first method: replace special symbols with escape characters
For example select * from Jy_handle WHERE createtime > "2017-07-27 00:00:00" can be converted to
SELECT * from Jy_handle WHERE createtime > "2017-07-27 00:00:00"
Replace ">" with >
The following are common XML escape characters
XML Common escape Character descriptor
| > |
< |
| < |
> |
| & |
& |
| ‘ |
' |
| " |
" |
Second approach: Using <! [cdata[]]> For instructions, do not parse this symbol, examples are as follows:
For example, select * from test WHERE createtime > "2017-07-27 00:00:00" can be converted to
<! [cdata[SELECT * from Test WHERE createtime > "2017-07-27 00:00:00" ]]>
Handle greater than sign less than sign in SQL in MyBatis