diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-09-24 10:15:50 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:46 +0000 |
commit | 485b97be9f2f2abf5a40923b5fd85f75714a8c02 (patch) | |
tree | ca05cb0ecf3828d909a898c3e5805804a0aff5f8 /t/03_create_table.t | |
download | perl-dbd-sqlite-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/perl-dbd-sqlite-tarball/DBD-SQLite-1.38_01.tar.gz.HEADDBD-SQLite-1.38_01masterbaserock/morph
Diffstat (limited to 't/03_create_table.t')
-rw-r--r-- | t/03_create_table.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/03_create_table.t b/t/03_create_table.t new file mode 100644 index 0000000..4c13449 --- /dev/null +++ b/t/03_create_table.t @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +# Tests simple table creation + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +use t::lib::Test; +use Test::More tests => 7; +use Test::NoWarnings; + +my $dbh = connect_ok(); +$dbh->do(<<'END_SQL'); +CREATE TABLE f +( +f1 integer NOT NULL PRIMARY KEY, +f2 integer, +f3 text +) +END_SQL + +# Confirm fix for #34408: Primary key name wrong with newline in CREATE TABLE +my $pkh = $dbh->primary_key_info( undef, undef, 'f' ); +my @pk = $pkh->fetchall_arrayref(); +is_deeply( \@pk, [ [ [ undef, 'main', 'f', 'f1', 1, 'PRIMARY KEY' ] ] ], '->primary_key_info ok' ); + +my $sth = $dbh->prepare("SELECT f.f1, f.* FROM f"); +isa_ok( $sth, 'DBI::st' ); +ok( $sth->execute, '->execute ok' ); +my $names = $sth->{NAME}; +is( scalar(@$names), 4, 'Got 4 columns' ); +is_deeply( $names, [ 'f1', 'f1', 'f2', 'f3' ], 'Table prepending is disabled by default' ); + |