sql standard: \' or ''

Started by CSNalmost 22 years ago6 messagesgeneral
Jump to latest
#1CSN
cool_screen_name90001@yahoo.com

I heard that the sql standard for escaping quotes is
'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not ''.

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#2Gregory Wood
gwood@ewebengine.com
In reply to: CSN (#1)
Re: sql standard: \' or ''

CSN wrote:

I heard that the sql standard for escaping quotes is
'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not ''.

Are you sure about that?

~# php -r "print pg_escape_string(\"I can't believe that quotes are
escaped improperly\n\");"
I can''t believe that quotes are escaped improperly

Greg

#3CSN
cool_screen_name90001@yahoo.com
In reply to: Gregory Wood (#2)
Re: sql standard: \' or ''
--- Gregory Wood <gwood@ewebengine.com> wrote:

CSN wrote:

I heard that the sql standard for escaping quotes

is

'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not ''.

Are you sure about that?

~# php -r "print pg_escape_string(\"I can't believe
that quotes are
escaped improperly\n\");"
I can''t believe that quotes are escaped improperly

Greg

Weird. Via cgi it escapes them as \' and via cli as
'', for me anyway.

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#4CSN
cool_screen_name90001@yahoo.com
In reply to: CSN (#3)
Re: sql standard: \' or ''
--- CSN <cool_screen_name90001@yahoo.com> wrote:
--- Gregory Wood <gwood@ewebengine.com> wrote:

CSN wrote:

I heard that the sql standard for escaping

quotes

is

'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not

''.

Are you sure about that?

~# php -r "print pg_escape_string(\"I can't

believe

that quotes are
escaped improperly\n\");"
I can''t believe that quotes are escaped

improperly

Greg

Weird. Via cgi it escapes them as \' and via cli as
'', for me anyway.

er, nevermind, magic_quotes_gpc is doing the \'.

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#5Bill Moran
wmoran@potentialtech.com
In reply to: CSN (#3)
Re: sql standard: \' or ''

CSN wrote:

--- Gregory Wood <gwood@ewebengine.com> wrote:

CSN wrote:

I heard that the sql standard for escaping quotes

is

'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not ''.

Are you sure about that?

~# php -r "print pg_escape_string(\"I can't believe
that quotes are
escaped improperly\n\");"
I can''t believe that quotes are escaped improperly

Greg

Weird. Via cgi it escapes them as \' and via cli as
'', for me anyway.

Check your php.ini

There are config options to change the behaviour of most escape
functions. Off the top of my head, I don't know for sure what
settings will affect pg_escape_string() but I'd be willing to
be that's the issue.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

#6scott.marlowe
scott.marlowe@ihs.com
In reply to: CSN (#3)
Re: sql standard: \' or ''

On Wed, 5 May 2004, CSN wrote:

--- Gregory Wood <gwood@ewebengine.com> wrote:

CSN wrote:

I heard that the sql standard for escaping quotes

is

'', and not \'. Is this true?

BTW, PHP's pg_escape_string returns \' and not ''.

Are you sure about that?

~# php -r "print pg_escape_string(\"I can't believe
that quotes are
escaped improperly\n\");"
I can''t believe that quotes are escaped improperly

Greg

Weird. Via cgi it escapes them as \' and via cli as
'', for me anyway.

Maybe their different versions? an older one that uses \' and a newer one
that uses ''?

Just a guess.