cromedome has asked for the wisdom of the Perl Monks concerning the following question:
use File::Basename; use DBI; my ($dbase) = @ARGV; # Access Table definition # Table name=blob # field1=recid,integer # field2=name,text # field3=mymemo,memo # # Establish database and connect... my $DSN = "driver=Microsoft Access Driver (*.mdb);dbq=$dbase"; my $dbh = DBI->connect("dbi:ODBC:$DSN","","") or die "$DBI::errstr\n"; # Set up longreadlen so we can do more than the default of 80... # Really does not solve the problem, but here it is... $dbh->{LongReadLen} = 2000; # Build some strings my $fifty = "12345678901234567890123456789012345678901234567890"; my $twoHundredFifty = "$fifty$fifty$fifty$fifty$fifty"; my $twoHundredFifty3 = join '',"$twoHundredFifty","123"; my $twoHundredFifty4 = join '',"$twoHundredFifty","1234"; my $twoHundredFifty5 = join '',"$twoHundredFifty","123**"; my $twoHundredFifty6 = join '',"$twoHundredFifty","123***"; my $fiveHundred3 = join '',"$twoHundredFifty","$twoHundredFifty","***" +; # Do some clean up... $dbh->do("delete from blob"); # Define sql statement for updating memo field. $sql = "insert into blob (name,mymemo) values(?,?)"; # Bind values to statement and execute... # This one should work... $dbh->do($sql,undef,"first",$twoHundredFifty5); my $error = $dbh->errstr; print("Errorstring 1 = >$error<\n"); # Bind values to statement and execute... # This one will fail... $dbh->do($sql,undef,"second",$twoHundredFifty6); my $error = $dbh->errstr; print("Errorstring 2 = >$error<\n"); # Define sql statement for updating memo field. $sql = "update blob set mymemo=? where name=?"; # Bind values to statement and execute... # This one fails... $dbh->do($sql,undef,$twoHundredFifty6,"first"); my $error = $dbh->errstr; print("Errorstring 3 = >$error<\n"); exit; STDOUT Errorstring 1 = >< Errorstring 2 = >[Microsoft][ODBC Microsoft Access Driver]Invalid prec +ision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter err=-1)< Errorstring 3 = >[Microsoft][ODBC Microsoft Access Driver]Invalid prec +ision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter err=-1)<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI problem with Access's Memo field
by FouRPlaY (Monk) on Oct 31, 2000 at 23:04 UTC | |
|
Re: DBI problem with Access's Memo field
by cadfael (Friar) on Nov 01, 2000 at 20:08 UTC |