comparison DBD/t/05gi.t @ 0:cedccb7e0143

Copy of clients/perl directory without Tests from MonetDB changeset 4d2d4532228a.
author Sjoerd Mullender <sjoerd@acm.org>
date Mon, 19 Sep 2016 15:15:52 +0200 (2016-09-19)
parents
children a0ec9e080a5b
comparison
equal deleted inserted replaced
-1:000000000000 0:cedccb7e0143
1 #!perl -I./t
2
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 #
7 # Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
8
9 $| = 1;
10
11 use strict;
12 use warnings;
13 use DBI();
14
15 use Test::More;
16
17 if (defined $ENV{DBI_DSN}) {
18 plan tests => 9;
19 } else {
20 plan skip_all => 'Cannot test without DB info';
21 }
22
23 pass('Get info tests');
24
25 my $dbh = DBI->connect or die "Connect failed: $DBI::errstr\n";
26 pass('Database connection created');
27
28 eval { $dbh->get_info };
29 ok( $@,"Call to get_info with 0 arguments, error expected: $@");
30
31 my $get_info = {
32 SQL_DBMS_NAME => 17
33 , SQL_DBMS_VER => 18
34 , SQL_IDENTIFIER_QUOTE_CHAR => 29
35 , SQL_CATALOG_NAME_SEPARATOR => 41
36 , SQL_CATALOG_LOCATION => 114
37 };
38
39 for ( sort keys %$get_info ) {
40 my $info = $dbh->get_info( $get_info->{$_} );
41 ok( defined $info,"get_info( $get_info->{$_} ) ($_): $info");
42 }
43
44 eval {
45
46 print "\nList of all defined GetInfo types:\n";
47
48 require DBI::Const::GetInfoType;
49 require DBI::Const::GetInfoReturn;
50
51 for ( sort keys %DBI::Const::GetInfoType::GetInfoType ) {
52 my $Nr = $DBI::Const::GetInfoType::GetInfoType{$_};
53 my $Val = $dbh->get_info( $Nr );
54 next unless defined $Val;
55 my $Str = DBI::Const::GetInfoReturn::Format( $_, $Val );
56 my $Exp = join ' | ', DBI::Const::GetInfoReturn::Explain( $_, $Val );
57 printf " %6d %-35s %-13s %s\n", $Nr, $_, $Str, $Exp;
58 }
59 };
60 ok( $dbh->disconnect,'Disconnect');
61
62 __END__
63
64 SQL_CATALOG_LOCATION => 114
65 , SQL_CATALOG_NAME_SEPARATOR => 41
66 , SQL_CATALOG_TERM => 42
67 , SQL_CONCAT_NULL_BEHAVIOR => 22
68 , SQL_DATA_SOURCE_NAME => 2
69 , SQL_DBMS_NAME => 17
70 , SQL_DBMS_VER => 18
71 , SQL_DBMS_VERSION => 18
72 , SQL_DRIVER_NAME => 6
73 , SQL_DRIVER_VER => 7
74 , SQL_IDENTIFIER_CASE => 28
75 , SQL_IDENTIFIER_QUOTE_CHAR => 29
76 , SQL_KEYWORDS => 89
77 , SQL_OWNER_TERM => 39
78 , SQL_PROCEDURE_TERM => 40
79 , SQL_QUALIFIER_LOCATION => 114
80 , SQL_QUALIFIER_NAME_SEPARATOR => 41
81 , SQL_QUALIFIER_TERM => 42
82 , SQL_SCHEMA_TERM => 39
83 , SQL_TABLE_TERM => 45
84 , SQL_USER_NAME => 47