DBI: sql_type_cast - question
Do I something wrong or is sql_type_cast
not supported by my constellation?
#!/usr/bin/env perl
use warnings;
use 5.012;
use DBI qw(:sql_types);
my $dsn = "DBI:Proxy:hostname=horst;port=2000;dsn=DBI:ODBC:db1.mdb";
my $dbh = DBI->connect( $dsn, undef, undef, { RaiseError => 1, PrintError => 0 } )
or die $DBI::errstr;
my $sv = '4.8g';
my $sql_type = SQL_DOUBLE;
my $flags = DBIstcf_DISCARD_STRING;
my $sts = DBI->sql_type_cast( $sv, $sql_type, $flags );
dies with
# Usage: DBI::sql_type_cast(sv, sql_type, fla开发者_JAVA技巧gs=0) at ./perl.pl line 14.
It's a bug in the manual. sql_type_cast
must be called as a function, not a method. Try:
my $sts = DBI::sql_type_cast( $sv, $sql_type, $flags );
(Note that ->
has been changed to ::
.)
精彩评论