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

Reply via email to