File: rt118977-zerofill.t

package info (click to toggle)
libdbd-mysql-perl 4.053-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,128 kB
  • sloc: ansic: 4,780; perl: 836; makefile: 29; sh: 22
file content (24 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Test::More;
use DBI;

use vars qw($test_dsn $test_user $test_password);
require "t/lib.pl";

my $dbh = eval { DBI->connect($test_dsn, $test_user, $test_password, { PrintError => 1, RaiseError => 1 }) };
plan skip_all => "no database connection" if $@ or not $dbh;

plan tests => 4*2;

for my $mysql_server_prepare (0, 1) {

	$dbh->{mysql_server_prepare} = $mysql_server_prepare;

	ok $dbh->do("DROP TABLE IF EXISTS t");
	ok $dbh->do("CREATE TEMPORARY TABLE t(id smallint(5) unsigned zerofill)");
	ok $dbh->do("INSERT INTO t(id) VALUES(1)");
	is $dbh->selectcol_arrayref("SELECT id FROM t")->[0], "00001";

}