From: | "Jordi" <jordil2(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Problem with character ' (single quote) in text fields |
Date: | 2002-01-21 10:42:12 |
Message-ID: | a2gqr0$968$1@news.tht.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have an old problem using the single quote (') character in text field
because Postgresql thinks it is the "end of text" character. The '
characther is used a lot in my language. As a workaround I'm parsing the
fields duplicating the ' characters inside the text but this is a bad
solution because:
Assuming field1 and field2 are text field, as I usually use in my
programs something like :
...
sprintf (auxstr, "SELECT field WHERE field=%s AND field2=%s" , vartext1,
vartext2);
..
As vartext1 and vartext2 can contain the ' so I need to create char[size]
variables to save the output of my "duplicate ' characters" function.
Something like:
char[SIZE] vartext1;
char[SIZE] vartext2;
DuplicateSingleQuote (OriginalText1, vartext1); //vartext1 is the new
valid text to insert
DuplicateSingleQuote(OriginalText2, vartext2);
sprintf(...)
So the code is full of temporary chart[] variables.
Is there any way to change the start/end of Text field character or do you
know a better workaround to avoid parsing/changing all the text fields just
in case they contain the single quote ( ') character??.
Best regards,
Jordi
From | Date | Subject | |
---|---|---|---|
Next Message | Einar Karttunen | 2002-01-21 11:35:49 | Re: Problem with character ' (single quote) in text fields |
Previous Message | Matthew Kirkwood | 2002-01-21 10:39:46 | Re: [GENERAL] PostgreSQL Licence: GNU/GPL |