Thanks Michael, I know that I shouldn't be re-quoting anything I've already quoted with DB quote. That example I gave was before the DB prepare or execute, when just trying to print it to screen.
Example $var = "I'm really wishing that I used "MySQL" as then I can use placeholders"; $var = $dbh->quote($var); print "$var"; I end up with I''m really wishing that I used "MySQL" as then I can use placeholders When I should have I''m really wishing that I used ""MySQL"" as then I can use placeholders Any idea why? Thanks -Chris ----- Original Message ----- From: "Michael Peppler" <[EMAIL PROTECTED]> To: "Chris Faust" <[EMAIL PROTECTED]> Cc: "Tim Bunce" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, April 10, 2004 11:50 PM Subject: Re: DBI->quote with DBD::Sysbase > On Sat, 2004-04-10 at 03:24, Chris Faust wrote: > > > Do double quotes really need to be doubled when embedded within a > > > single quoted string? In other words, isn't 'foo"bar' correct for Sybase? > > > > > > Are you quoting literal strings or schema identifiers? > > > > > > Tim. > > > > Thanks for the reply Tim, > > > > I'm quoting literal strings and I'm afraid in this case it does no good to > > have any double quotes within a single quoted string. > > > > For an example: > > > > $var = "I'm really wishing that I used "MySQL" as then I can use > > placeholders". > > $var = $dbh->quote($var); > > $var now equals: > > 'I''m really wishing that I used "MySQL" because I could use placeholders.' > > I think that you're not using the quote()'d string correctly. > > I just tried the following: > > my $dbh = DBI->connect('dbi:Sybase:server=luthien;database=testdb', > 'sa', ''); > my $str = $dbh->quote(q(I'm really wishing that I used "MySQL" as then I > can use placeholders)); > my $sth = $dbh->prepare("insert var_test values($str)"); > $sth->execute; > > which inserted the row correctly. You need to remember that the string > returned by quote() should be used as-is, without any quotes around it. > > Michael > -- > Michael Peppler Data Migrations, Inc. > [EMAIL PROTECTED] http://www.peppler.org/ > Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or > long term contract positions - http://www.peppler.org/resume.html >