File: rt_115465_column_info_with_spaces.t

package info (click to toggle)
libdbd-sqlite3-perl 1.62-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,708 kB
  • sloc: ansic: 140,930; perl: 8,458; pascal: 286; makefile: 7
file content (38 lines) | stat: -rw-r--r-- 789 bytes parent folder | download
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;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use lib "t/lib";
use SQLiteTest;
use Test::More;

plan tests => 14;
use Test::NoWarnings;

{
	my $dbh = connect_ok();
	$dbh->do('create table test ( foo varchar(10), bar varchar( 15 ), baz decimal(3,3), bat decimal(4, 4))');
	my %info = map {
		$_->{COLUMN_NAME} => [@$_{qw/TYPE_NAME COLUMN_SIZE DECIMAL_DIGITS/}]
	} @{$dbh->column_info(undef, undef, 'test', '%')->fetchall_arrayref({})};

	is $info{foo}[0] => 'varchar';
	is $info{foo}[1] => '10';
	is $info{foo}[2] => undef;

	is $info{bar}[0] => 'varchar';
	is $info{bar}[1] => '15';
	is $info{bar}[2] => undef;

	is $info{baz}[0] => 'decimal';
	is $info{baz}[1] => 3;
	is $info{baz}[2] => 3;

	is $info{bat}[0] => 'decimal';
	is $info{bat}[1] => 4;
	is $info{bat}[2] => 4;
}