Codebase list libdbix-introspector-perl / 0d25f10
Imported Upstream version 0.001005 gregor herrmann 8 years ago
12 changed file(s) with 47 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
00 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
17
28 0.001003 2014-06-21 09:47:56-05:00 America/Chicago
39 - 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.
11
22 This is free software; you can redistribute it and/or modify it under
33 the same terms as the Perl 5 programming language system itself.
1111
1212 --- The GNU General Public License, Version 1, February 1989 ---
1313
14 This software is Copyright (c) 2014 by Arthur Axel "fREW" Schmidt.
14 This software is Copyright (c) 2015 by Arthur Axel "fREW" Schmidt.
1515
1616 This is free software, licensed under:
1717
271271
272272 --- The Artistic License 1.0 ---
273273
274 This software is Copyright (c) 2014 by Arthur Axel "fREW" Schmidt.
274 This software is Copyright (c) 2015 by Arthur Axel "fREW" Schmidt.
275275
276276 This is free software, licensed under:
277277
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.
11 Changes
22 LICENSE
33 MANIFEST
33 "Arthur Axel \"fREW\" Schmidt <frioux+cpan@gmail.com>"
44 ],
55 "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",
77 "license" : [
88 "perl_5"
99 ],
1515 "prereqs" : {
1616 "configure" : {
1717 "requires" : {
18 "ExtUtils::MakeMaker" : "6.30"
18 "ExtUtils::MakeMaker" : "0"
1919 }
2020 },
2121 "develop" : {
4646 "web" : "https://github.com/frioux/DBIx-Introspector"
4747 }
4848 },
49 "version" : "0.001003"
49 "version" : "0.001005"
5050 }
5151
66 Test::More: '0.99'
77 Test::Roo: '1.002'
88 configure_requires:
9 ExtUtils::MakeMaker: '6.30'
9 ExtUtils::MakeMaker: '0'
1010 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'
1212 license: perl
1313 meta-spec:
1414 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2020 resources:
2121 homepage: https://github.com/frioux/DBIx-Introspector
2222 repository: https://github.com/frioux/DBIx-Introspector.git
23 version: '0.001003'
23 version: '0.001005'
00
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.
22 use strict;
33 use warnings;
44
55
66
7 use ExtUtils::MakeMaker 6.30;
7 use ExtUtils::MakeMaker ;
88
99
1010
1212 "ABSTRACT" => "Detect what database you are connected to",
1313 "AUTHOR" => "Arthur Axel \"fREW\" Schmidt <frioux+cpan\@gmail.com>",
1414 "CONFIGURE_REQUIRES" => {
15 "ExtUtils::MakeMaker" => "6.30"
15 "ExtUtils::MakeMaker" => 0
1616 },
1717 "DISTNAME" => "DBIx-Introspector",
1818 "EXE_FILES" => [],
2727 "Test::More" => "0.99",
2828 "Test::Roo" => "1.002"
2929 },
30 "VERSION" => "0.001003",
30 "VERSION" => "0.001005",
3131 "test" => {
3232 "TESTS" => "t/*.t"
3333 }
11 DBIx::Introspector - Detect what database you are connected to
22
33 VERSION
4 version 0.001003
4 version 0.001005
55
66 SYNOPSIS
77 my $d = DBIx::Introspector->new(drivers => '2013-12.01');
3232 if you needed to detect which version of your given database you are
3333 connected to that would not be difficult.
3434
35 Furthermore, "DBIx::Introspector" does it's best to try to detect
35 Furthermore, "DBIx::Introspector" does its best to try to detect
3636 information based on the dsn you give it if you have not yet connected,
3737 so you can possibly avoid connection or at least defer connection.
3838
192192 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
193193
194194 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.
196196
197197 This is free software; you can redistribute it and/or modify it under
198198 the same terms as the Perl 5 programming language system itself.
11 author = Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
22 license = Perl_5
33 copyright_holder = Arthur Axel "fREW" Schmidt
4 version = 0.001003
4 version = 0.001005
55
66 [NextRelease]
77 [@Git]
1313
1414 =head1 VERSION
1515
16 version 0.001003
16 version 0.001005
1717
1818 =head1 Content
1919
138138
139139 =head1 COPYRIGHT AND LICENSE
140140
141 This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt.
141 This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt.
142142
143143 This is free software; you can redistribute it and/or modify it under
144144 the same terms as the Perl 5 programming language system itself.
7474 my $drivers_by_name = $args->{drivers_by_name};
7575 my $key = $args->{key};
7676
77 my $option = $self->_unconnected_options->{$key};
77 if (exists $self->_unconnected_options->{$key}) {
78 my $option = $self->_unconnected_options->{$key};
7879
79 if ($option) {
8080 return $option->($self, $args->{dbh})
8181 if ref $option && ref $option eq 'CODE';
8282 return $option;
9999 my $drivers_by_name = $args->{drivers_by_name};
100100 my $key = $args->{key};
101101
102 my $option = $self->_connected_options->{$key};
102 if (exists $self->_connected_options->{$key}) {
103 my $option = $self->_connected_options->{$key};
103104
104 if ($option) {
105105 return $option->($self, $args->{dbh}, $args->{dsn})
106106 if ref $option && ref $option eq 'CODE';
107107 return $option;
00 package DBIx::Introspector;
1 $DBIx::Introspector::VERSION = '0.001003';
1 $DBIx::Introspector::VERSION = '0.001005';
22 # ABSTRACT: Detect what database you are connected to
33
44 use Moo;
153153 })
154154 }
155155
156 die "wtf"
156 die "missing key: $key"
157157 }
158158
159159 sub _driver_for {
198198
199199 =head1 VERSION
200200
201 version 0.001003
201 version 0.001005
202202
203203 =head1 SYNOPSIS
204204
231231 detect which version of your given database you are connected to that
232232 would not be difficult.
233233
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
235235 based on the dsn you give it if you have not yet connected, so you can possibly
236236 avoid connection or at least defer connection.
237237
414414
415415 =head1 COPYRIGHT AND LICENSE
416416
417 This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt.
417 This software is copyright (c) 2015 by Arthur Axel "fREW" Schmidt.
418418
419419 This is free software; you can redistribute it and/or modify it under
420420 the same terms as the Perl 5 programming language system itself.
3333 borg => sub { 'magic ham' },
3434 },
3535 },
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 },
3846 ]
3947 );
4048
4654 'INSERT INTO "a" ("value") VALUES (1)',
4755 );
4856 is($d->get($dbh, 'dbi:SQLite::memory:', '_introspector_driver'), 'SQLite1');
57 is($d->get($dbh, 'dbi:SQLite::memory:', 'a'), 1, 'true bool');
4958 ok(exception { $d->get($dbh, 'dbi:SQLite::memory:', 'foo') }, 'unknown option dies');;
5059 $d->replace_driver({
5160 name => 'SQLite1',
5766 is($d->get($dbh, 'dbi:SQLite::memory:', 'foo'), 'bar');
5867 $dbh->do('UPDATE "a" SET "value" = 2');
5968 is($d->get($dbh, 'dbi:SQLite::memory:', '_introspector_driver'), 'SQLite2');
69 is($d->get($dbh, 'dbi:SQLite::memory:', 'a'), 0, 'false bool');
6070 is($d->get($dbh, 'dbi:SQLite::memory:', 'bar'), 2, 'oo dispatch');
6171
6272 is($d->get($dbh, 'dbi:SQLite::memory:', 'borg'), 'magic ham', 'working $dbh still dispatches to dsn');