开发者

How to insert escape characters in mysql

Hi I want to insert all escape characters in a column in MySQL. I can not insert \ always because a long data may have a lot escape 开发者_如何学运维characters.

Thanks Sunil Kumar Sahoo


I am not sure if I am getting this correct but you

  • have a lot of data
  • you want to insert them into database with regular SQL commands
  • most of data requires escaping.

So you have no much options. Since there is no direct binary mode in MySQL you

  • either execute SQL script with escaping
  • you will write parametrized queries and insert data directly with some custom tool you will write.

If choosing first approach have a look at MySQL manual for some escaping string details. Particularly you may escape one backslash \ with double backslashes \\ sequence. Also have a look at NO_BACKSLASH_ESCAPES, which eliminates need for escaping completly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜