RE: [INTERFACES] Still have problem with single quotation mark

From: Michael Wentzel <wentzel(at)THWT(dot)COM>
To: "'theofilu(at)eunet(dot)at'" <theofilu(at)eunet(dot)at>
Cc: "'pgsql-interfaces(at)postgreSQL(dot)org'" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: RE: [INTERFACES] Still have problem with single quotation mark
Date: 1999-09-13 20:26:29
Message-ID: A1C69E9A4D29D311AFE000A024CA0B0B5EDA@snax.thwt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

>There is still a problem with the single quotation mark (') inside a
>string, when this string is inserted into the database and one uses 'ecpg'.
>Someone on this list told me, that I should precede a ' with a second '
>(''). Then it would not be interpreted as the end of string. I did this and
>realy, now it is not interpreted at all. 'ecpg' puts now both quotation
>marks into the database table. This makes for example the words 'I don't
>want this' appear as 'I don''t want this'. Preceding the quotation mark
>with a backslash does not help also. Then I get the SQL error 'too many
>arguments in line xxx'. This is really annoying. How can I fix this?

Try escape characters. For example to place a single quote in a text field
use \' instead of ' the backslash tells SQL interpreter that the next
character
is not a special character but simply part of the string. Other examples
are:

\\ interprets as a single backslash character in the string
\" interprets as a double quote character in the string

Hope this helps.

Mike Wentzel
THWT Software

Browse pgsql-interfaces by date

  From Date Subject
Next Message Sergio A. Kessler 1999-09-13 23:55:23 Re: [INTERFACES] odbc DM 3.5x
Previous Message Theofilu Andreas 1999-09-13 20:11:53 Still have problem with single quotation mark