File: bigint_quotes.pl

package info (click to toggle)
libdbd-mysql-perl 4.028-2%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,312 kB
  • ctags: 584
  • sloc: perl: 4,425; ansic: 4,259; makefile: 26
file content (38 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;