Thursday 15 May 2014

Disable escape characters in a MySQL query -


Is there a way to disable escape characters in a MySQL query? For example, for the following table:

  mysql> Choose * from Test1; + ------------------------ + ------- + | Name | Price | + ------------------------ + ------- + | C: \\ Media \ data \ temp \ | 1 | | C: \\ Media \ data \ temp | 2 | | / Unix / Media / Data / Temporary | 3 | | / Unix / Media / Data / Temporary / | 4 | + ------------------------ + ------- +   

I wanted to I have a valid query:

  mysql> Select * from test1 where name = 'c: \\ media \ data \ temp \';   

I know that instead of

  mysql> Choose * from Test1, where name = 'C: \\\\ media \\ data \ temp \\';   

But I am using this query my_snprintf (), so instead of me

  c: \\\\\\\\ media Using \\\\ data \\\\ temp \\\\   

... and so on! Is there a way to disable escape characters for a single MySQL query?

You can disable Backspace migrations by setting in SQL mode:

 < Code> - Save Mode & amp; Disable backslash SET @old_sql_mode = @@ sql_mode; SET @@ sql_mode = CONCAT_WS (',', @@ sql_mode, 'NO_BACKSLASH_ESCAPES'); - Select the query 'C: \\ Media \ data \ temp \'; - Enable Backslash SET @@ sql_mode = @ old_sql_mode;    

No comments:

Post a Comment