Avatar of Vladimir Buzalka
Vladimir BuzalkaFlag for Czechia

asked on 

What is idea behind escape characters?

Dear Experts

I am starting with mySQL and I cannot understand all the concept of escape characters in strings.

What was idea behind this? I have feeling that it makes my life just more difficult if I want to assure that string which I have in variable is indeed stored in mySQL in exact form.

Many thanks for your advices

Vladimir
MySQL Server

Avatar of undefined
Last Comment
Vladimir Buzalka
SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Paul Neralich
Paul Neralich
Flag of United States of America image

Hi Vladimir,
Adding a backslash character (\) before certain other characters forms a special command. For example:

\n "escapes" the literal letter "n" and instead is interpreted as a new line:

mysql> SELECT 'Paul nNeralich';
Paul nNeralich

mysql> SELECT 'Paul \nNeralich';
Paul
Neralich
Avatar of Paul Neralich
Paul Neralich
Flag of United States of America image

Can you give us an example of something you are trying to write to the database for which you feel you need to make use of escaping?
SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Paul Neralich
Paul Neralich
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Vladimir Buzalka

ASKER

Dear Experts

many thanks for your explanations, I think I can understand need for character escaping now.

Thanks a lot again

V
MySQL Server
MySQL Server

MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.

49K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo