Link to home
Start Free TrialLog in
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
SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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