string fields helps

Started by marcelo Cortezalmost 19 years ago6 messagesgeneral
Jump to latest
#1marcelo Cortez
jmdc_marcelo@yahoo.com.ar

Folks

I need to save data on rtf format but , postgres
refuses to storage for backslah or character's
problem's any idea or vice are welcomed best
regards
mdc

pd: sample off data to save ( from postgres log)

"
UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16
\par }
', version_ = 4 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 3 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG: statement: COMMIT1
LOG: statement: BEGIN
LOG: statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16 SELECT
"PARAMETROS"."PARAMETRO",
\par
substr(to_char("PARAMETROS"."F_VAL_PARAM",
''YYYY/MM/DD''), 1,10),
\par
substr(to_char("PARAMETROS"."F_ANUL_PARAM",''YYYY/MM/DD''),
1,10),
\par "PARAMETROS"."VALOR1",
\par "PARAMETROS"."VALOR2"
\par FROM "PARAMETROS"
\par " )
\par
\par }
', version_ = 5 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 4 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG: statement: COMMIT
LOG: statement: BEGIN
LOG: statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0
Tahoma;}{\f1\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs18 SELECT
"PARAMETROS"."PARAMETRO",
\par
substr(to_char("PARAMETROS"."F_VAL_PARAM",
''YYYY/MM/DD''), 1,10),
\par
substr(to_char("PARAMETROS"."F_ANUL_PARAM",''YYYY/MM/DD''),
1,10),
\par "PARAMETROS"."VALOR1",
\par "PARAMETROS"."VALOR2"
\par FROM "PARAMETROS"
\par " )
\par \f1\fs16
\par }
"

__________________________________________________
Pregunt�. Respond�. Descubr�.
Todo lo que quer�as saber, y lo que ni imaginabas,
est� en Yahoo! Respuestas (Beta).
�Probalo ya!
http://www.yahoo.com.ar/respuestas

#2Bill Moran
wmoran@potentialtech.com
In reply to: marcelo Cortez (#1)
Re: string fields helps

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> wrote:

Folks

I need to save data on rtf format but , postgres
refuses to storage for backslah or character's
problem's any idea or vice are welcomed best
regards
mdc

You need to escape the data before you insert it. This is language-
dependant, but any language that has PostgreSQL libraries will have
functions to escape text data.

pd: sample off data to save ( from postgres log)

"
UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16
\par }
', version_ = 4 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 3 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG: statement: COMMIT1
LOG: statement: BEGIN
LOG: statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16 SELECT
"PARAMETROS"."PARAMETRO",
\par
substr(to_char("PARAMETROS"."F_VAL_PARAM",
''YYYY/MM/DD''), 1,10),
\par
substr(to_char("PARAMETROS"."F_ANUL_PARAM",''YYYY/MM/DD''),
1,10),
\par "PARAMETROS"."VALOR1",
\par "PARAMETROS"."VALOR2"
\par FROM "PARAMETROS"
\par " )
\par
\par }
', version_ = 5 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 4 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG: statement: COMMIT
LOG: statement: BEGIN
LOG: statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0
Tahoma;}{\f1\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs18 SELECT
"PARAMETROS"."PARAMETRO",
\par
substr(to_char("PARAMETROS"."F_VAL_PARAM",
''YYYY/MM/DD''), 1,10),
\par
substr(to_char("PARAMETROS"."F_ANUL_PARAM",''YYYY/MM/DD''),
1,10),
\par "PARAMETROS"."VALOR1",
\par "PARAMETROS"."VALOR2"
\par FROM "PARAMETROS"
\par " )
\par \f1\fs16
\par }
"

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--
Bill Moran
http://www.potentialtech.com

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bill Moran (#2)
Re: string fields helps

Bill Moran <wmoran@potentialtech.com> writes:

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> wrote:

I need to save data on rtf format but , postgres
refuses to storage for backslah or character's
problem's any idea or vice are welcomed best

You need to escape the data before you insert it. This is language-
dependant, but any language that has PostgreSQL libraries will have
functions to escape text data.

Also, given that his main problem seems to be with backslashes, using
8.2 and setting standard_conforming_strings = on might help. It's still
the case that not using a proper escaping function will come back to
haunt you someday, though.

regards, tom lane

#4Michael Nolan
htfoot@gmail.com
In reply to: Tom Lane (#3)
Re: string fields helps

On 4/16/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

. It's still
the case that not using a proper escaping function will come back to
haunt you someday, though.

Has anybody written a 'proper escaping function' in php, something along the
lines of addslashes()?
--
Mike Nolan

#5Chris
dmagick@gmail.com
In reply to: Michael Nolan (#4)
Re: string fields helps

Has anybody written a 'proper escaping function' in php, something along
the lines of addslashes()?

It has been around for ages: http://php.net/pg_escape_string

--
Postgresql & php tutorials
http://www.designmagick.com/

#6marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Tom Lane (#3)
Re: string fields helps

Thanks Tom!

this works.
best regards
MDC

--- Tom Lane <tgl@sss.pgh.pa.us> escribi�:

Bill Moran <wmoran@potentialtech.com> writes:

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> wrote:

I need to save data on rtf format but , postgres

refuses to storage for backslah or character's
problem's any idea or vice are welcomed

best

You need to escape the data before you insert it.

This is language-

dependant, but any language that has PostgreSQL

libraries will have

functions to escape text data.

Also, given that his main problem seems to be with
backslashes, using
8.2 and setting standard_conforming_strings = on
might help. It's still
the case that not using a proper escaping function
will come back to
haunt you someday, though.

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

__________________________________________________
Pregunt�. Respond�. Descubr�.
Todo lo que quer�as saber, y lo que ni imaginabas,
est� en Yahoo! Respuestas (Beta).
�Probalo ya!
http://www.yahoo.com.ar/respuestas