Re: Trouble Escaping Quotes
От | Haron, Charles |
---|---|
Тема | Re: Trouble Escaping Quotes |
Дата | |
Msg-id | 593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL обсуждение исходный текст |
Ответ на | Trouble Escaping Quotes ("Haron, Charles" <charles.haron@cognitive.com>) |
Ответы |
Re: Trouble Escaping Quotes
|
Список | pgsql-admin |
Below is logging information from a client-side SQL monitor, as well as what I found in <posgresqlhome>/data/serverlog: I this particular instance the offending quote is in the problem_desc field. The value of problem_desc being "Bob's Problem" (double quotes excluded). *** Client-Side SQL monitor data *** SET TRANSACTION ISOLATION LEVEL READ COMMITTED;SET DATESTYLE TO ISO;BEGIN; insert into "rmas" ("id", "company_id", "repair_types_id", "printer_models_id", "serial_number", "problem_desc") values (1240916, 126, 3, 595, '45845384568', 'Bob''s Problem') Command executed sucessfully 1 row(s) affected Commiting transaction END; SELECT send_rma(rma_info) FROM rma_info WHERE rma = 1240916 server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. *** Information From <posgresqlhome>/data/serverlog *** server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: WARNING: Message from PostgreSQL backend: The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory. I have rolled back the current transaction and am going to terminate your database system connection and exit. Please reconnect to the database system and repeat your query. Failed. > -----Original Message----- > From: Richard Poole [mailto:rp@guests.deus.net] > Sent: Sunday, January 23, 2005 11:59 AM > To: pgsql-admin@postgresql.org > Cc: Haron, Charles > Subject: Re: Trouble Escaping Quotes > > On Fri, Jan 21, 2005 at 08:43:00AM -0700, Haron, Charles wrote: > > Yes, but how do you escape the quote when the value of the string > > isn't know until the function is run? > > > > If $rma_data->{\'company_name\'} is returning Bob's Fixit > at run time, > > how do escape the quote BEFORE Perl interprets the string and > > generates an error? > > Your quote-escaping looks fine to me; \' is just as good as > '', although less standard. I can't reproduce your problem > here; your function works for me under 8.0.0 and perl 5.8.6 . > What's your error message when you call it? Are you sure that > your problem isn't happening earlier, when you put the data > into the database in the first place? > > > Richard >
В списке pgsql-admin по дате отправления: