Imported Upstream version 0.001005
gregor herrmann
8 years ago
0 | 0 | Revision history for DBIx-Introspector |
1 | ||
2 | 0.001005 2015-01-29 17:47:49-06:00 America/Chicago | |
3 | - Fix error message for missing values (Thanks Wes Malone!) | |
4 | ||
5 | 0.001004 2014-11-30 21:50:34-06:00 America/Chicago | |
6 | - Fix bug that disallowed false values | |
1 | 7 | |
2 | 8 | 0.001003 2014-06-21 09:47:56-05:00 America/Chicago |
3 | 9 | - Fix ::Announcement POD which was shadowing the real docs |
0 | This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
0 | This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
1 | 1 | |
2 | 2 | This is free software; you can redistribute it and/or modify it under |
3 | 3 | the same terms as the Perl 5 programming language system itself. |
11 | 11 | |
12 | 12 | --- The GNU General Public License, Version 1, February 1989 --- |
13 | 13 | |
14 | This software is Copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
14 | This software is Copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
15 | 15 | |
16 | 16 | This is free software, licensed under: |
17 | 17 | |
271 | 271 | |
272 | 272 | --- The Artistic License 1.0 --- |
273 | 273 | |
274 | This software is Copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
274 | This software is Copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
275 | 275 | |
276 | 276 | This is free software, licensed under: |
277 | 277 |
0 | # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.019. | |
0 | # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.020. | |
1 | 1 | Changes |
2 | 2 | LICENSE |
3 | 3 | MANIFEST |
3 | 3 | "Arthur Axel \"fREW\" Schmidt <frioux+cpan@gmail.com>" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 0, |
6 | "generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.141170", | |
6 | "generated_by" : "Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060", | |
7 | 7 | "license" : [ |
8 | 8 | "perl_5" |
9 | 9 | ], |
15 | 15 | "prereqs" : { |
16 | 16 | "configure" : { |
17 | 17 | "requires" : { |
18 | "ExtUtils::MakeMaker" : "6.30" | |
18 | "ExtUtils::MakeMaker" : "0" | |
19 | 19 | } |
20 | 20 | }, |
21 | 21 | "develop" : { |
46 | 46 | "web" : "https://github.com/frioux/DBIx-Introspector" |
47 | 47 | } |
48 | 48 | }, |
49 | "version" : "0.001003" | |
49 | "version" : "0.001005" | |
50 | 50 | } |
51 | 51 |
6 | 6 | Test::More: '0.99' |
7 | 7 | Test::Roo: '1.002' |
8 | 8 | configure_requires: |
9 | ExtUtils::MakeMaker: '6.30' | |
9 | ExtUtils::MakeMaker: '0' | |
10 | 10 | dynamic_config: 0 |
11 | generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.141170' | |
11 | generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060' | |
12 | 12 | license: perl |
13 | 13 | meta-spec: |
14 | 14 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
20 | 20 | resources: |
21 | 21 | homepage: https://github.com/frioux/DBIx-Introspector |
22 | 22 | repository: https://github.com/frioux/DBIx-Introspector.git |
23 | version: '0.001003' | |
23 | version: '0.001005' |
0 | 0 | |
1 | # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019. | |
1 | # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.020. | |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | use ExtUtils::MakeMaker 6.30; | |
7 | use ExtUtils::MakeMaker ; | |
8 | 8 | |
9 | 9 | |
10 | 10 | |
12 | 12 | "ABSTRACT" => "Detect what database you are connected to", |
13 | 13 | "AUTHOR" => "Arthur Axel \"fREW\" Schmidt <frioux+cpan\@gmail.com>", |
14 | 14 | "CONFIGURE_REQUIRES" => { |
15 | "ExtUtils::MakeMaker" => "6.30" | |
15 | "ExtUtils::MakeMaker" => 0 | |
16 | 16 | }, |
17 | 17 | "DISTNAME" => "DBIx-Introspector", |
18 | 18 | "EXE_FILES" => [], |
27 | 27 | "Test::More" => "0.99", |
28 | 28 | "Test::Roo" => "1.002" |
29 | 29 | }, |
30 | "VERSION" => "0.001003", | |
30 | "VERSION" => "0.001005", | |
31 | 31 | "test" => { |
32 | 32 | "TESTS" => "t/*.t" |
33 | 33 | } |
1 | 1 | DBIx::Introspector - Detect what database you are connected to |
2 | 2 | |
3 | 3 | VERSION |
4 | version 0.001003 | |
4 | version 0.001005 | |
5 | 5 | |
6 | 6 | SYNOPSIS |
7 | 7 | my $d = DBIx::Introspector->new(drivers => '2013-12.01'); |
32 | 32 | if you needed to detect which version of your given database you are |
33 | 33 | connected to that would not be difficult. |
34 | 34 | |
35 | Furthermore, "DBIx::Introspector" does it's best to try to detect | |
35 | Furthermore, "DBIx::Introspector" does its best to try to detect | |
36 | 36 | information based on the dsn you give it if you have not yet connected, |
37 | 37 | so you can possibly avoid connection or at least defer connection. |
38 | 38 | |
192 | 192 | Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
193 | 193 | |
194 | 194 | COPYRIGHT AND LICENSE |
195 | This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
195 | This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
196 | 196 | |
197 | 197 | This is free software; you can redistribute it and/or modify it under |
198 | 198 | the same terms as the Perl 5 programming language system itself. |
1 | 1 | author = Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
2 | 2 | license = Perl_5 |
3 | 3 | copyright_holder = Arthur Axel "fREW" Schmidt |
4 | version = 0.001003 | |
4 | version = 0.001005 | |
5 | 5 | |
6 | 6 | [NextRelease] |
7 | 7 | [@Git] |
13 | 13 | |
14 | 14 | =head1 VERSION |
15 | 15 | |
16 | version 0.001003 | |
16 | version 0.001005 | |
17 | 17 | |
18 | 18 | =head1 Content |
19 | 19 | |
138 | 138 | |
139 | 139 | =head1 COPYRIGHT AND LICENSE |
140 | 140 | |
141 | This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
141 | This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
142 | 142 | |
143 | 143 | This is free software; you can redistribute it and/or modify it under |
144 | 144 | the same terms as the Perl 5 programming language system itself. |
74 | 74 | my $drivers_by_name = $args->{drivers_by_name}; |
75 | 75 | my $key = $args->{key}; |
76 | 76 | |
77 | my $option = $self->_unconnected_options->{$key}; | |
77 | if (exists $self->_unconnected_options->{$key}) { | |
78 | my $option = $self->_unconnected_options->{$key}; | |
78 | 79 | |
79 | if ($option) { | |
80 | 80 | return $option->($self, $args->{dbh}) |
81 | 81 | if ref $option && ref $option eq 'CODE'; |
82 | 82 | return $option; |
99 | 99 | my $drivers_by_name = $args->{drivers_by_name}; |
100 | 100 | my $key = $args->{key}; |
101 | 101 | |
102 | my $option = $self->_connected_options->{$key}; | |
102 | if (exists $self->_connected_options->{$key}) { | |
103 | my $option = $self->_connected_options->{$key}; | |
103 | 104 | |
104 | if ($option) { | |
105 | 105 | return $option->($self, $args->{dbh}, $args->{dsn}) |
106 | 106 | if ref $option && ref $option eq 'CODE'; |
107 | 107 | return $option; |
0 | 0 | package DBIx::Introspector; |
1 | $DBIx::Introspector::VERSION = '0.001003'; | |
1 | $DBIx::Introspector::VERSION = '0.001005'; | |
2 | 2 | # ABSTRACT: Detect what database you are connected to |
3 | 3 | |
4 | 4 | use Moo; |
153 | 153 | }) |
154 | 154 | } |
155 | 155 | |
156 | die "wtf" | |
156 | die "missing key: $key" | |
157 | 157 | } |
158 | 158 | |
159 | 159 | sub _driver_for { |
198 | 198 | |
199 | 199 | =head1 VERSION |
200 | 200 | |
201 | version 0.001003 | |
201 | version 0.001005 | |
202 | 202 | |
203 | 203 | =head1 SYNOPSIS |
204 | 204 | |
231 | 231 | detect which version of your given database you are connected to that |
232 | 232 | would not be difficult. |
233 | 233 | |
234 | Furthermore, C<DBIx::Introspector> does it's best to try to detect information | |
234 | Furthermore, C<DBIx::Introspector> does its best to try to detect information | |
235 | 235 | based on the dsn you give it if you have not yet connected, so you can possibly |
236 | 236 | avoid connection or at least defer connection. |
237 | 237 | |
414 | 414 | |
415 | 415 | =head1 COPYRIGHT AND LICENSE |
416 | 416 | |
417 | This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt. | |
417 | This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt. | |
418 | 418 | |
419 | 419 | This is free software; you can redistribute it and/or modify it under |
420 | 420 | the same terms as the Perl 5 programming language system itself. |
33 | 33 | borg => sub { 'magic ham' }, |
34 | 34 | }, |
35 | 35 | }, |
36 | { name => 'SQLite1', parents => ['SQLite'] }, | |
37 | { name => 'SQLite2', parents => ['SQLite'] }, | |
36 | { | |
37 | name => 'SQLite1', | |
38 | parents => ['SQLite'], | |
39 | unconnected_options => { a => 1 }, | |
40 | }, | |
41 | { | |
42 | name => 'SQLite2', | |
43 | parents => ['SQLite'], | |
44 | unconnected_options => { a => 0 }, | |
45 | }, | |
38 | 46 | ] |
39 | 47 | ); |
40 | 48 | |
46 | 54 | 'INSERT INTO "a" ("value") VALUES (1)', |
47 | 55 | ); |
48 | 56 | is($d->get($dbh, 'dbi:SQLite::memory:', '_introspector_driver'), 'SQLite1'); |
57 | is($d->get($dbh, 'dbi:SQLite::memory:', 'a'), 1, 'true bool'); | |
49 | 58 | ok(exception { $d->get($dbh, 'dbi:SQLite::memory:', 'foo') }, 'unknown option dies');; |
50 | 59 | $d->replace_driver({ |
51 | 60 | name => 'SQLite1', |
57 | 66 | is($d->get($dbh, 'dbi:SQLite::memory:', 'foo'), 'bar'); |
58 | 67 | $dbh->do('UPDATE "a" SET "value" = 2'); |
59 | 68 | is($d->get($dbh, 'dbi:SQLite::memory:', '_introspector_driver'), 'SQLite2'); |
69 | is($d->get($dbh, 'dbi:SQLite::memory:', 'a'), 0, 'false bool'); | |
60 | 70 | is($d->get($dbh, 'dbi:SQLite::memory:', 'bar'), 2, 'oo dispatch'); |
61 | 71 | |
62 | 72 | is($d->get($dbh, 'dbi:SQLite::memory:', 'borg'), 'magic ham', 'working $dbh still dispatches to dsn'); |