Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6F14C475ECE for ; Fri, 22 Nov 2002 13:38:14 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 06857475AE4 for ; Fri, 22 Nov 2002 13:38:14 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id E171443A582; Fri, 22 Nov 2002 13:38:13 -0500 (EST) From: Jeff Boes X-Newsgroups: comp.databases.postgresql.sql Subject: Re: escape single quote in INSERT command Date: Fri, 22 Nov 2002 13:38:17 -0500 Organization: Nexcerpt, Inc. Lines: 26 Message-ID: References: <27ad91d2.0211220500.19633b93@posting.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Pan/0.11.4 (Unix) X-Comment-To: "Hunter" To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/348 X-Sequence-Number: 10490 On Fri, 22 Nov 2002 08:00:01 -0500, Hunter wrote: > I have a perl application for a registration form. I'd like to put > escape characters in my insert command to accommodate for ' (i.e. > O'Brien, O'Malley, etc). I've tired double quotes, single quotes, back > tick, forward ticks, curly bracket, round brackets - no success. Are you using the DBI interface? That's the most straightforward way to accomplish this. Something like this: use strict; use DBI; my $dbh = DBI->new(...see docs for details...); $dbh->do(q|INSERT INTO mytable (col1) VALUES (?)|, undef, q|O'Malley|) or die $DBI::errstr; $dbh->commit; By using the '?' placeholder format for statements, you can pass in any data without having to worry about quoting. -- Jeff Boes vox 616.226.9550 ext 24 Database Engineer fax 616.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt... Extend your Expertise