?
Solved

I want to prepare a string for mysql insert by handling a single quote

Posted on 2012-03-29
4
Medium Priority
?
350 Views
Last Modified: 2012-03-29
I have string with single quotes that I need to handle before inserting into mysql.

Quote examples are      hel'lo    or   hello'    or  'hello


How can I use a perl regex to add another single quote in front of the single quote within the string?

hel''lo
0
Comment
Question by:dmalovich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37783627
Two single quotes doesn't provide an escape sequence in MySQL.  It does work in Microsoft SQL Server / T-SQL.  Which one are you working with?
0
 

Author Comment

by:dmalovich
ID: 37783740
MySql
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 37783935
See here:  http://dev.mysql.com/doc/refman/5.0/en/string-literals.html   There is a link at the bottom of the page to Perl methods.
0
 

Author Closing Comment

by:dmalovich
ID: 37783950
Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Six Sigma Control Plans
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question