Subject: | primary key columns where the column name contains a space are incorrectly reported |
Test case attached. Not sure if this is database-specific, or what.
I'm using SQLite 3.6.23.1.
Subject: | sqlite-thing.pl |
use 5.010;
use strict;
use Data::Dumper;
use DBI;
use DBIx::Admin::TableInfo;
use Test::More tests => 3;
my $db = DBI->connect('dbi:SQLite:database=:memory:')
or die $DBI::errstr;
$db->do($_) for
q[CREATE TABLE "Country Info" ("Country Code" CHAR(2) PRIMARY KEY, "Name" VARCHAR(200))],
q[INSERT INTO "Country Info" VALUES ('DE', 'Germany')],
q[INSERT INTO "Country Info" VALUES ('FR', 'France')];
my $info = DBIx::Admin::TableInfo->new(dbh => $db)->info;
my @key = values %{$info->{'Country Info'}{primary_keys}};
is(
$info->{'Country Info'}{columns}{'Country Code'}{COLUMN_NAME},
'Country Code',
'In "columns" data, column name is reported correctly.',
);
is(
scalar(@key),
1,
'The primary key column was found.',
);
is(
$key[0]->{COLUMN_NAME},
'Country Code',
'The primary key column name is reported correctly.',
);