Special characters

Started by Mihai Gheorghiuover 24 years ago3 messagesgeneral
Jump to latest
#1Mihai Gheorghiu
tanethq@earthlink.net

Yet another newbie question...
The database I'm working on will have fields with special characters: CR/LF,
' (like in O'Malley) etc.
Is there an easy way to deal with this (in INSERT, UPDATE and SELECT), or
should the front end application (Java) take care of escaping those
characters?
E.g. The user searches for O'Malley in the lastname field.

Thank you,

Mihai Gheorghiu

#2Doug McNaught
doug@wireboard.com
In reply to: Mihai Gheorghiu (#1)
Re: Special characters

"Mihai Gheorghiu" <tanethq@earthlink.net> writes:

Yet another newbie question...
The database I'm working on will have fields with special characters: CR/LF,
' (like in O'Malley) etc.
Is there an easy way to deal with this (in INSERT, UPDATE and SELECT), or
should the front end application (Java) take care of escaping those
characters?

If you use PreparedStatements, the JDBC driver will quote and escape
the arguments appropriately. If you don't, and build your SQL on the
fly, you'll have to do it yourself.

-Doug
--
Free Dmitry Sklyarov!
http://www.freesklyarov.org/

We will return to our regularly scheduled signature shortly.

#3Mihai Gheorghiu
tanethq@earthlink.net
In reply to: Doug McNaught (#2)
Re: Special characters

Thank you very much.
I located it.

-----Original Message-----
From: Doug McNaught <doug@wireboard.com>
To: Mihai Gheorghiu <tanethq@earthlink.net>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Date: Friday, August 17, 2001 11:30 AM
Subject: Re: [GENERAL] Special characters

"Mihai Gheorghiu" <tanethq@earthlink.net> writes:

Yet another newbie question...
The database I'm working on will have fields with special characters:

CR/LF,

Show quoted text

' (like in O'Malley) etc.
Is there an easy way to deal with this (in INSERT, UPDATE and SELECT), or
should the front end application (Java) take care of escaping those
characters?

If you use PreparedStatements, the JDBC driver will quote and escape
the arguments appropriately. If you don't, and build your SQL on the
fly, you'll have to do it yourself.

-Doug
--
Free Dmitry Sklyarov!
http://www.freesklyarov.org/

We will return to our regularly scheduled signature shortly.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster