[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

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

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
dmalovich
Asked:
dmalovich
  • 2
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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
 
dmalovichAuthor Commented:
MySql
0
 
Dave BaldwinFixer of ProblemsCommented:
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
 
dmalovichAuthor Commented:
Thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now