in reply to SQL quoting problem

What does MyStoredProg do? Does it rehandle that string in such a way that you should double pass the string thru your quoter? ala

$dbh->do('exec sp_MyStoredProg @foo=' . $dbh->quote($dbh->quote($bar)) +);
That is ugly but that MIGHT be it.

--
$you = new YOU;
honk() if $you->love(perl)

Replies are listed 'Best First'.
RE: Re: SQL quoting problem
by lhoward (Vicar) on Oct 14, 2000 at 04:46 UTC
    Thanks to everyone for all their help. Everyone gets a ++, but extremely gets the gold star! It was his comment about double-quoting that let me to a solution to my problem. Turns out that quoting it twice won't do it, because that doubles the surrounding quotes too. But I got the following to work:
    $bar=~s/'/''/g; $dbh->do('exec sp_MyStoredProg @foo=' . $dbh->quote($bar));
    which effectively turns something like can't into 'can''''t', which is just what the stored proc needs.

    Thanks again to everyone!