Problem with inserting newlines and ' characters

Поиск
Список
Период
Сортировка
Искать
От
Alan Horn
Тема
Problem with inserting newlines and ' characters
Дата
Msg-id
Pine.NEB.4.21.0007241425580.26888-100000@gilgamesh.inktomi.co.uk
Список
Дерево обсуждения
Problem with inserting newlines and ' characters Alan Horn <ahorn@inktomi.com>
Re: Problem with inserting newlines and ' characters Kyle <kaf@nwlink.com>

Hi,

This may actually be more of a limitation with the DBD::Pg perl driver.
I'm not sure.

Basically I'm using DBD::Pg in a perl script which inserts data into a
very simple table.

The statement I'm using is thus :

my($sth) = $dbh->prepare("insert into maintenance (sno, date, data) values
('$sno', '$date', '$tmpstring')");

(all on one line of course...)

My problem is this. $tmpstring may well contain embedded newlines or '
characters (these are the two characters I've had problems with so far).

I don't want to go down the route of rewriting those characters into
something 'unique' and decoding whenever I extract information from the
table. That's always struck me as a bit of a kludge.

So, is it a problem with postgresql, or DBD::Pg, or (most likely) what I'm
doing with them... ?

Any help much appreciated.

Cheers,

Al






В списке pgsql-general по дате отправления
От: Philip Warner
Дата:
От: Mitch Vincent
Дата:
FAQ