develooper Front page | perl.beginners | Postings from February 2009

DBI Placeholder Issue

From:
Thomas Yan
Date:
February 19, 2009 23:45
Subject:
DBI Placeholder Issue
Message ID:
0KFC006HITK7IG@pnmsmail.neusoft.com
Hi All,

I want to query the database log of SQL Server using DBI:ODBC and I
encounter a problem.

I want to use "select * from ::fn_dblog(null,null)" to query the log, but
DBI takes :: as placeholder and fails. As follows,

         use DBI;

         my $dbh = DBI->connect("dbi:ODBC:MyDSN")

                  or die "Can't connect: $DBI::errstr\n";

         my $query = qq{

                                            select * from
::fn_dblog(null,null)

                            };

         my $sth = $dbh->prepare($query) ;  

         $sth->execute( ) or die $dbh->errstr;

I run the script and the output is:

Can't rebind placeholder fn_dblog at F:\zDataBase\db.pl line 29.

 

How to fix it ?

Best regards!

Thomas Yan




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About