Re: Carraige Return issues

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Carraige Return issues
Дата
Msg-id 1025872021.31584.21.camel@linda
обсуждение исходный текст
Ответ на Re: Carraige Return issues  ("caroline kenny" <caroline_kenny@hotmail.com>)
Список pgsql-general
On Fri, 2002-07-05 at 11:51, caroline kenny wrote:
> Thanks Oliver for your help....but I'm still having a small issue..
>
> What Im really trying to do is to insert/update a field in a particular
> table through perl script.
> When i run the perl script to insert the specifics into my table...i want
> that the file that to be entered into the specific field will be put in with
> its carriage returns....can u help further

So you're using UPDATE or INSERT called through your Perl script?

You need to replace newline with \n in the data being inserted or escape
the linefeeds with \.  You also need to escape any real backslash with
an extra backslash and you need to escape single-quotes, either with a
backslash or an extra single-quote.

    junk=# insert into tt values (3,'Line 1 of ''some\ntext with\
    junk'# linefeeds in it\n and \\s too.');
    INSERT 27417478 1
    junk=# select t from tt where id = 3;
                               t
    --------------------------------------------------------
     Line 1 of 'some
    text with
    linefeeds in it
     and \s too.
    (1 row)


If you're using Windows, you may also have to deal with their use of
CRLF as a line ending, as opposed to Unix's LF, but all that can be done
in Perl.

The Perl coding is left as an exercise for the reader - meaning I can't
work it out without looking things up!

Oliver




В списке pgsql-general по дате отправления:

Предыдущее
От: "caroline kenny"
Дата:
Сообщение: Re: Carraige Return issues
Следующее
От: Angela Luyf
Дата:
Сообщение: two primairy key in one table ?