Can you upgrade to a newer version of DBI ?
The latest one is 1.21, I believe.
The following code works on my Win2K PC (cygwin, PostgreSQL, DBI 1.201, ActivePerl 5.6.1)
use DBD::ODBC;
use DBI;
my $p = {};
my $t_id = '20';
$p->{P_BATS} = 'R';
$p->{P_THROWS} = 'R';
$p->{P_STATUS} = 'A';
$p->{P_PLAYERID} = 1;
my $dbh = DBI->connect('DBI:ODBC:test', 'foo', 'bar', {RaiseError => 1
+});
my $sth = $dbh->prepare(qq/UPDATE players SET t_id=?, bats=?, throws=?
+, status=? WHERE id=?/);
$sth->execute($t_id, $p->{P_BATS}, $p->{P_THROWS}, $p->{P_STATUS}, $p-
+>{P_PLAYERID});
$sth = $dbh->prepare(qq/SELECT * FROM players/);
$sth->execute();
while (my @row = $sth->fetchrow_array()){
print join(',', @row),"\n";
}
$dbh->disconnect();
Table 'players' is defined as follows
test=# \d players
Table "players"
Attribute | Type | Modifier
-----------+-----------------------+----------
id | integer |
t_id | character varying(20) |
bats | character varying(20) |
throws | character varying(20) |
status | character varying(20) |
--perlplexer
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.