Re: [GENERAL] Text data type doesn't accept newlines?

2001-06-12 Thread Neil Conway

On Wed, Jun 06, 2001 at 09:24:19AM -0400, Randall Perry wrote:
> Just checked the Pg docs, don't see a quote function. What is it part of?

It's part of DBI, a system for connecting Perl to databases. You can use
DBI with Postgres -- but apparently you're not doing this, since you
mentioned you're using Pg.pm (the plain interface to libpq). The
Postgres driver for DBI is called DBD::Pg, BTW -- make sure you don't
get them confused.

So the advice below WRT using 'quote' doesn't apply.

BTW, you might want to checkout DBI -- I find it to be more pleasant to
use than Pg.pm

Cheers,

Neil

> > Are you using the "quote" function? You have to use it if you are to
> > guarantee that the data will be acceptable as "input".
> > 
> > $myVar = $myDB -> quote ($myVar)


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] Text data type doesn't accept newlines?

2001-06-07 Thread Gordan Bobic

Not sure, but the syntax is as I described below. Try checking the
perl DBD::Pg documentation. I think that's where I read about it
originally, many moons ago.

> Just checked the Pg docs, don't see a quote function. What is it
part of?
>
>
> > Are you using the "quote" function? You have to use it if you are
to
> > guarantee that the data will be acceptable as "input".
> >
> > $myVar = $myDB -> quote ($myVar)
> >
> >
> >> I'm using the Pg perl interface. But, think my problem was that I
> > had
> >> unescaped single quotes in the string. Added the following to my
> > code to
> >> escape them and it works now:
> >>
> >> $self->{errors} =~ s"'"\\'"g;# escape single quotes
> >
> >
> >
> >
> > ---(end of
broadcast)---
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
> --
> Randy Perry
> sysTame
> Mac Consulting/Sales
>
> phn 561.589.6449
> mobile email[EMAIL PROTECTED]
>
>
>
>
>



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



Re: [GENERAL] Text data type doesn't accept newlines?

2001-06-06 Thread Gordan Bobic

Are you using the "quote" function? You have to use it if you are to
guarantee that the data will be acceptable as "input".

$myVar = $myDB -> quote ($myVar)


> I'm using the Pg perl interface. But, think my problem was that I
had
> unescaped single quotes in the string. Added the following to my
code to
> escape them and it works now:
>
> $self->{errors} =~ s"'"\\'"g;# escape single quotes




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



Re: [GENERAL] Text data type doesn't accept newlines?

2001-06-05 Thread Randall Perry

on 6/5/01 12:00 PM, Bryan White at [EMAIL PROTECTED] wrote:

>> I have a logging database that logs errors. The error messages contain
>> newlines. Pgsql doesn't accept them on insert in a text data field.
> 
> I have never had a problem storing newlines in a text field.  What interface
> are you using?
> The only ascii character that I have found I have to escape is the single
> quote character.
> -
> Bryan White
> 
> 
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
> 

I'm using the Pg perl interface. But, think my problem was that I had
unescaped single quotes in the string. Added the following to my code to
escape them and it works now:

$self->{errors} =~ s"'"\\'"g;# escape single quotes


-- 
Randy Perry
sysTame
Mac Consulting/Sales





---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [GENERAL] Text data type doesn't accept newlines?

2001-06-05 Thread Bryan White

> I have a logging database that logs errors. The error messages contain
> newlines. Pgsql doesn't accept them on insert in a text data field.

I have never had a problem storing newlines in a text field.  What interface
are you using?
The only ascii character that I have found I have to escape is the single
quote character.
-
Bryan White


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])