Solved

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

Posted on 2012-03-29
4
341 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
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
MySql
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now