• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • 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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

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