pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPunctuation problems.
3+ messages / 3 participants
[nested] [flat]
* Punctuation problems.
@ 2003-08-10 13:55 Alastair G. Hogge <agh@tpg.com.au>
2003-08-11 01:54 ` Re: Punctuation problems. Ron Johnson <ron.l.johnson@cox.net>
2003-08-11 08:09 ` Re: Punctuation problems. D'Arcy J.M. Cain <darcy@PyGreSQL.org>
0 siblings, 2 replies; 3+ messages in thread
From: Alastair G. Hogge @ 2003-08-10 13:55 UTC (permalink / raw)
To: pgsql-interfaces
Hello list,
I'm using PyGreSQL to access my database to store information gathered from
HTML forms (using CGI). However I've run into a problem with some of the data
retrived.
For example say a user of my HTML form inputs their name "Eick O'Shae".
Now when I try to store that I get problems due the ' I think. Is there a way
I can store and ' in the DB? Also are there other symbols should be aware of,
and can I store them also? This email probably isn't making much sense as I'm
very tired and have been looking at this screen for hours, but any help would
great.
Thanks
-Al
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Punctuation problems.
2003-08-10 13:55 Punctuation problems. Alastair G. Hogge <agh@tpg.com.au>
@ 2003-08-11 01:54 ` Ron Johnson <ron.l.johnson@cox.net>
1 sibling, 0 replies; 3+ messages in thread
From: Ron Johnson @ 2003-08-11 01:54 UTC (permalink / raw)
To: pgsql-interfaces
On Sun, 2003-08-10 at 08:55, Alastair G. Hogge wrote:
> Hello list,
>
> I'm using PyGreSQL to access my database to store information gathered from
> HTML forms (using CGI). However I've run into a problem with some of the data
> retrived.
>
> For example say a user of my HTML form inputs their name "Eick O'Shae".
> Now when I try to store that I get problems due the ' I think. Is there a way
> I can store and ' in the DB? Also are there other symbols should be aware of,
> and can I store them also? This email probably isn't making much sense as I'm
> very tired and have been looking at this screen for hours, but any help would
> great.
The escape character "\".
test1=# create table foo (f text);
CREATE TABLE
test1=# insert into foo values ('x');
INSERT 17266 1
test1=# select * from foo;
f
---
x
(1 row)
test1=# insert into foo values ('\'x\'');
INSERT 17267 1
test1=# select * from foo;
f
-----
x
'x'
(2 rows)
In Python:
>>> a = "Eick O'Shae"
>>> a1 = a.split("'")
>>> a2 = a1[0]+"\\'"+a1[1]
>>> print a2
Eick O\'Shae
--
+---------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron.l.johnson@cox.net |
| Jefferson, LA USA |
| |
| "Man, I'm pretty. Hoo Hah!" |
| Johnny Bravo |
+---------------------------------------------------------------+
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Punctuation problems.
2003-08-10 13:55 Punctuation problems. Alastair G. Hogge <agh@tpg.com.au>
@ 2003-08-11 08:09 ` D'Arcy J.M. Cain <darcy@PyGreSQL.org>
1 sibling, 0 replies; 3+ messages in thread
From: D'Arcy J.M. Cain @ 2003-08-11 08:09 UTC (permalink / raw)
To: Alastair G. Hogge <agh@tpg.com.au>; pgsql-interfaces
On Sunday 10 August 2003 09:55, Alastair G. Hogge wrote:
> I'm using PyGreSQL to access my database to store information gathered from
> HTML forms (using CGI). However I've run into a problem with some of the
> data retrived.
>
> For example say a user of my HTML form inputs their name "Eick O'Shae".
> Now when I try to store that I get problems due the ' I think. Is there a
> way I can store and ' in the DB? Also are there other symbols should be
> aware of, and can I store them also? This email probably isn't making much
> sense as I'm very tired and have been looking at this screen for hours, but
> any help would great.
Are you using the "Classic" interface of the "DB-API" interface?
Note that PyGreSQL has its own list. You can get more information at
http://www.PyGreSQL.org.
--
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-08-11 08:09 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-10 13:55 Punctuation problems. Alastair G. Hogge <agh@tpg.com.au>
2003-08-11 01:54 ` Ron Johnson <ron.l.johnson@cox.net>
2003-08-11 08:09 ` D'Arcy J.M. Cain <darcy@PyGreSQL.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox