forked from perl5-dbi/DBD-mysql
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.perl.org/modules/DBD-mysql/trunk@12690 50811bd7-b8ce-0310-adc1-d9db26280581
- Loading branch information
capttofu
committed
Apr 13, 2009
1 parent
775da62
commit ef87e45
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use DBI; | ||
use Data::Dumper; | ||
|
||
my $create= <<'EOTABLE'; | ||
create table bigt1 ( | ||
id bigint unsigned not null default 0 | ||
) | ||
EOTABLE | ||
|
||
#my $dbh= DBI->connect('DBI:mysql:test', 'root', 'root', { mysql_bind_type_guessing => 2}) | ||
# or die "unable to connect $DBI::errstr"; | ||
my $dbh= DBI->connect('DBI:mysql:test', 'root', 'root') | ||
or die "unable to connect $DBI::errstr"; | ||
|
||
$dbh->{mysql_bind_type_guessing}= 1; | ||
|
||
$dbh->do('drop table if exists bigt1'); | ||
$dbh->do($create); | ||
|
||
my $statement= 'insert into bigt1 (id) values (?)'; | ||
|
||
my $sth= $dbh->prepare($statement); | ||
|
||
my $rows= $sth->execute('9999999999999999'); | ||
print "rows $rows\n"; | ||
|
||
$statement= 'update bigt1 set id = ?'; | ||
$sth= $dbh->prepare($statement); | ||
$rows= $sth->execute('9999999999999998'); | ||
print "rows $rows\n"; | ||
|
||
my $retref= $dbh->selectall_arrayref('select * from bigt1'); | ||
print Dumper $retref; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use DBI; | ||
use DBI::Const::GetInfoType; | ||
use Test::More; | ||
use lib 't', '.'; | ||
require 'lib.pl'; | ||
|
||
use vars qw($test_dsn $test_user $test_password $table); | ||
|
||
my $dbh; | ||
eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password, | ||
{ RaiseError => 1, PrintError => 1, AutoCommit => 0 });}; | ||
if ($@) { | ||
plan skip_all => | ||
"ERROR: $DBI::errstr. Can't continue test"; | ||
} | ||
plan tests => 29; | ||
|
||
ok $dbh->do("DROP TABLE IF EXISTS $table"), "drop table if exists $table"; | ||
|
||
my $create= <<"EOTABLE"; | ||
create table $table ( | ||
id bigint unsigned not null default 0 | ||
) | ||
EOTABLE | ||
|
||
|
||
ok $dbh->do($create), "creating table"; | ||
|
||
my $statement= 'insert into bigt1 (id) values (?)'; | ||
|
||
$sth1; | ||
ok $sth1= $dbh->prepare($statement); | ||
|
||
my $rows; | ||
ok $rows= $sth1->execute('9999999999999999'); | ||
cmp_ok $rows, '==', 1; | ||
|
||
$statement= 'update bigt1 set id = ?'; | ||
my $sth2; | ||
ok $sth2= $dbh->prepare($statement); | ||
|
||
ok $rows= $sth2->execute('9999999999999998'); | ||
cmp_ok $rows, '==', 1; | ||
|
||
$dbh->{mysql_bind_type_guessing}= 1; | ||
ok $rows= $sth1->execute('9999999999999997'); | ||
cmp_ok $rows, '==', 1; | ||
|
||
$statement= 'update bigt1 set id = ? where id = ?'; | ||
|
||
ok $sth2= $dbh->prepare($statement); | ||
ok $rows= $sth1->execute('9999999999999996', '9999999999999997'); | ||
|
||
my $retref; | ||
ok $retref= $dbh->selectall_arrayref('select * from bigt1'); | ||
|
||
cmp_ok $retref->[0][0], '==', 9999999999999998; | ||
cmp_ok $retref->[0][0], '==', 9999999999999996; |