From: Vincent Stoessel <vincent@xaymaca.com>
To: Dave Carrigan <dave@rudedog.org>
Cc: Tod McQuillin <devin@spamcop.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: escaping arrays in perl dbi
Date: Thu, 09 May 2002 17:00:12 -0400
Message-ID: <3CDAE35C.6000109@xaymaca.com> (raw)
References: <Pine.GSO.4.44.0205090932520.8544-100000@sysadmin>
<87lmattk5w.fsf@cbgb.rudedog.org>
Thank you everyone for all of the great answers.
Dave Carrigan wrote:
> Tod McQuillin <devin@spamcop.net> writes:
>
>
>>But try using DBI parameters like this:
>>
>>$dbh->prepare("update basket set f_order = ? where cap = ?");
>>$dbh->execute('{"apple",0}', 'I');
>>
>>DBI should take care of all the quoting and escaping for you.
>
>
> This is the best way to do it, but you can shorten it with:
>
> $dbh->do("update basket set f_order = ? where cap = ?",
> undef, '{"apple",0}', 'I');
>
> If you don't want to use the parameterized mechanism, Perl's qq operator
> is your friend:
>
> $dbh->do(qq(update basket set f_order = {"apple",0} where cap = 'I'));
>
--
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: vincent@xaymaca.com, dave@rudedog.org, devin@spamcop.net
Subject: Re: escaping arrays in perl dbi
In-Reply-To: <3CDAE35C.6000109@xaymaca.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox