Codebase list libjifty-dbi-perl / 833ed55
[svn-upgrade] new version libjifty-dbi-perl (0.67) Jonathan Yu 13 years ago
14 changed file(s) with 85 addition(s) and 52 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Perl extension Jifty::DBI.
1
2 0.67 2011-02-28
3 - Features:
4 * Make ->distinct_column_values use ->simple_query, thus going through our
5 SQL logging infrastructure (Alex Vandiver)
6
7 - Fixes:
8 * Set raw_values in load_by_hash so the __raw_value method works when the
9 record is loaded by a collection (Thomas Sibley)
10
11 - Tests:
12 * Author tests for no tabs (Shawn M Moore)
113
214 0.66 2011-02-14
315 - Features:
9898 t/99-pod-coverage.t
9999 t/99-pod-spelling.t
100100 t/99-pod.t
101 t/99-tabs.t
101102 t/case_sensitivity.t
102103 t/metadata.t
103104 t/testmodels.pl
4646 version: 0
4747 resources:
4848 license: http://dev.perl.org/licenses/
49 version: 0.66
49 version: 0.67
1414 Hash: SHA1
1515
1616 SHA1 418a58763132c9a476627cbdce5ff01395ce84d4 .gitignore
17 SHA1 37266036389c91467c5bccd288f584a2b2415617 Changes
18 SHA1 18b75d45e40e1ff66f673bab9fdaf37edf93794e MANIFEST
19 SHA1 e5d135ba5b8445d15c5f6e0998ac08a10504936f META.yml
17 SHA1 45d9eaf8a622fdfc0bb9680396e2843eca5ec346 Changes
18 SHA1 c2fb135f967d7093a6191d1b7e5e596e30040246 MANIFEST
19 SHA1 f21d5f2dc45943fbc09ac079b2b18d942a6f3f81 META.yml
2020 SHA1 48bd6ca8a37ec79b7cae91028d7e9489ad33a03b Makefile.PL
2121 SHA1 e29d7b270f78a5a406921571b08290c46f2a42f6 README
2222 SHA1 82d6ac3f6def48558d09f8b6e3b53ed4194d8c81 ROADMAP
4040 SHA1 026cc0551a0ad399d195e395b46bdf842e115192 inc/Module/Install/Metadata.pm
4141 SHA1 5457015ea5a50e93465bf2dafa29feebd547f85b inc/Module/Install/Win32.pm
4242 SHA1 051e7fa8063908befa3440508d0584a2497b97db inc/Module/Install/WriteAll.pm
43 SHA1 8963f051b47634cc0d5b8baf90804a2d6c59efe7 lib/Jifty/DBI.pm
44 SHA1 b69be5d3f06d651772e4a65ec6e6e3da6e9e419d lib/Jifty/DBI/Collection.pm
43 SHA1 84ab56168fb14f1530c035b549c2af0750f0fd60 lib/Jifty/DBI.pm
44 SHA1 e0375edf9f501e6b9c723fced70431108188419b lib/Jifty/DBI/Collection.pm
4545 SHA1 503ca4cf6693580dedf8adee58267532f8467908 lib/Jifty/DBI/Collection/Union.pm
4646 SHA1 bcba77fd2bacf0475aea1de97f57365c8de92ca6 lib/Jifty/DBI/Collection/Unique.pm
47 SHA1 ac2e81ee7f24e65bcb40c86746f3e4159aeefb25 lib/Jifty/DBI/Column.pm
47 SHA1 3ff96d74a769439111fba7b42b0c100d180ba6cd lib/Jifty/DBI/Column.pm
4848 SHA1 9f6a6435d358a79108e98e379e252139457c1e9f lib/Jifty/DBI/Filter.pm
4949 SHA1 05d100a1a9cd24c6c0285660edf3758d5f04c1c7 lib/Jifty/DBI/Filter/Boolean.pm
5050 SHA1 d0addaa43cfa8950cb33d42a364a3c3c56a2dd59 lib/Jifty/DBI/Filter/Date.pm
6868 SHA1 cf80896a175702a157770f64ae469430678c3357 lib/Jifty/DBI/Handle/mysql.pm
6969 SHA1 f2cc4fcce79c9a88a023d4e6bd96c2089eef1ced lib/Jifty/DBI/Handle/mysqlPP.pm
7070 SHA1 b7eca843dfbf0607bde08f566b2d03ba52fe82fd lib/Jifty/DBI/HasFilters.pm
71 SHA1 169e97345e6b581d88564da97cd3c1267ba0f010 lib/Jifty/DBI/Record.pm
71 SHA1 e6710da080f80146fe7bbe75338c5ef382f0bd4a lib/Jifty/DBI/Record.pm
7272 SHA1 663978b31373520d1e2deec87e957d1dbfd1347c lib/Jifty/DBI/Record/Cachable.pm
7373 SHA1 e30b1a3be2101d839a0a57e921e6f87889ef8da1 lib/Jifty/DBI/Record/Memcached.pm
7474 SHA1 53834b3315a509ba33a8647681f472d3ae7b0557 lib/Jifty/DBI/Record/Plugin.pm
75 SHA1 67504194de870031d285ae4d45acf257738577f4 lib/Jifty/DBI/Schema.pm
75 SHA1 302f3c09c4d5625ad8db4c0ddaafe8cd0207ea97 lib/Jifty/DBI/Schema.pm
7676 SHA1 0e347c238e62424ca029d60ac03fce75bb2af2a2 lib/Jifty/DBI/SchemaGenerator.pm
7777 SHA1 32834b7c4cf5a8d131382fccc8db341be8768291 t/00.load.t
7878 SHA1 9aa7fed2b2409faa4c71d2a45db210721f47403e t/01-version_checks.t
110110 SHA1 32457dd407414a89bd82d7fe59afab1014f8f920 t/18triggers.t
111111 SHA1 befc46d5364088775b6dda5ae1cf970c1b0fa4e8 t/19reference.t
112112 SHA1 72a16ddfc2642564023448450f3475ae5abf6d86 t/20overload.t
113 SHA1 cf5b3950070fda63ba1b497f7d89dd6c36ae9c93 t/99-pod-coverage.t
114 SHA1 12002f10b761d5952c5dc5143321379405283f9a t/99-pod-spelling.t
115 SHA1 73b9826ff54a26efc2fa19edaf80d3ad961529be t/99-pod.t
113 SHA1 0e7ceb6deb91ae0c15bbd42f946b65a44e704706 t/99-pod-coverage.t
114 SHA1 6ab50a9c21584c841e8ece93bba46d779d82992b t/99-pod-spelling.t
115 SHA1 8841b06de7875ffba985ce82c347737ca098aa1a t/99-pod.t
116 SHA1 82ee6497512299eea11063a3610d4fbc429d49b6 t/99-tabs.t
116117 SHA1 5e1158a9340410d46ffad19f381982159dccc924 t/case_sensitivity.t
117 SHA1 1dd9675b0a9a59fdcd300f5d92297f0ecf4f03e4 t/metadata.t
118 SHA1 f0ce911fe0b4bdc70fe9dbb524d8cd89bedfc904 t/metadata.t
118119 SHA1 97e60dd523a74a886c170eeb05b813aa551f5efe t/testmodels.pl
119120 SHA1 653c2f961d8b4f195e5391cd261f37815068e8d5 t/utils.pl
120121 -----BEGIN PGP SIGNATURE-----
121 Version: GnuPG v1.4.10 (Darwin)
122 Version: GnuPG v1.4.10 (GNU/Linux)
122123
123 iEYEARECAAYFAk1ZnfAACgkQsxfQtHhyRPq6YQCfaTsXkpzasgXlv41gDq6JTpci
124 khMAmwT7upq90E4xMjqIZEjJVVIcmRq9
125 =osRu
124 iD8DBQFNa8XhHdv9ZfNcOAcRAmUeAJ4zMQK4gRNn+i7pu3EzlZN2jhXkpQCfcgER
125 Z8gawoecAhAUhGjBuFm0yAM=
126 =1fkV
126127 -----END PGP SIGNATURE-----
971971 .' '. ($args{'sort'} =~ /^des/i ? 'DESC' : 'ASC');
972972 }
973973
974 my $dbh = $self->_handle->dbh;
975 my $list = $dbh->selectcol_arrayref( $query_string, { MaxRows => $args{'max'} } );
976 return $list? @$list : ();
974 my $sth = $self->_handle->simple_query( $query_string ) or return;
975 my $value;
976 $sth->bind_col(1, \$value) or return;
977 my @col;
978 if ($args{max}) {
979 push @col, $value while 0 < $args{max}-- && $sth->fetch;
980 } else {
981 push @col, $value while $sth->fetch;
982 }
983 return @col;
977984 }
978985
979986 =head2 items_array_ref
5454 no strict 'refs';
5555 *$attr = sub {
5656 my $self = shift;
57 $self->attributes({}) unless $self->attributes;
57 $self->attributes({}) unless $self->attributes;
5858 return $self->attributes->{$attr} unless @_;
5959 $self->attributes->{$attr} = (@_ == 1 ? $_[0] : [@_]);
6060 }
9090 # not in @attrs into attributes and just pass the whole hash
9191 $self->attributes({});
9292 for (keys %$args) {
93 $self->can($_) ? $self->$_($args->{$_}) : $self->attributes->{$_} = $args->{$_};
93 $self->can($_) ? $self->$_($args->{$_}) : $self->attributes->{$_} = $args->{$_};
9494 }
9595
9696 return $self;
12141214 # Optimization for loading from database
12151215 $self->{values} = $hashref;
12161216 $self->{fetched}{$_} = 1 for keys %{$hashref};
1217 $self->{raw_values} = {};
1217 # copy $hashref so changing 'values' doesn't change 'raw_values'
1218 $self->{raw_values}{$_} = $hashref->{$_} for keys %{$hashref};
12181219 $self->{decoded} = {};
12191220 return $self->{values}{id};
12201221 }
12301231 foreach my $col ( grep exists $hashref->{ lc $_ }, map $_->name, $self->columns ) {
12311232 $self->{'fetched'}{$col} = 1;
12321233 $self->{'values'}{$col} = $hashref->{ lc $col };
1234 $self->{'raw_values'}{$col} = $hashref->{ lc $col };
12331235 }
12341236
12351237 $self->{'decoded'} = {};
7272 # looks like a type name but not found
7373 return ($_[0] => 1) unless $typehandler;
7474 return $typehandler->();
75 },
75 },
7676 are => '',
7777 as => '',
7878 ajax => 'ajax_',
207207 my $from = caller;
208208
209209 my $new_code = sub {
210 no warnings 'redefine';
211 local *_ = sub { my $args = \@_; defer { _(@$args) } };
212 $from->_init_columns;
213
214 my @columns = &declare($code);
215
216 # Unimport all our symbols from the calling package,
217 # except for "lazy" and "defer".
218 foreach my $sym (@EXPORT) {
219 next if $sym eq 'lazy' or $sym eq 'defer';
220
221 no strict 'refs';
222 undef *{"$from\::$sym"}
223 if \&{"$from\::$sym"} == \&$sym;
224 }
225
226 foreach my $column (@columns) {
227 next if !ref($column);
228 _init_column($column);
229 }
210 no warnings 'redefine';
211 local *_ = sub { my $args = \@_; defer { _(@$args) } };
212 $from->_init_columns;
213
214 my @columns = &declare($code);
215
216 # Unimport all our symbols from the calling package,
217 # except for "lazy" and "defer".
218 foreach my $sym (@EXPORT) {
219 next if $sym eq 'lazy' or $sym eq 'defer';
220
221 no strict 'refs';
222 undef *{"$from\::$sym"}
223 if \&{"$from\::$sym"} == \&$sym;
224 }
225
226 foreach my $column (@columns) {
227 next if !ref($column);
228 _init_column($column);
229 }
230230
231231 $from->_init_methods_for_columns;
232232 };
11 use warnings;
22 use strict;
33
4 $Jifty::DBI::VERSION = '0.66';
4 $Jifty::DBI::VERSION = '0.67';
55
66 =head1 NAME
77
00 use Test::More;
1 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
2
13 eval "use Test::Pod::Coverage 1.00";
24 plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
3 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
45 all_pod_coverage_ok( );
56
67 # Workaround for dumb bug (fixed in 5.8.7) where Test::Builder thinks that
22 use strict;
33 use Test::More;
44 eval "use Test::Spelling";
5 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
6
57 plan skip_all => "Test::Spelling required for testing POD spelling" if $@;
6 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
78
89 add_stopwords(<DATA>);
910
00 use Test::More;
1 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
2
13 eval "use Test::Pod 1.00";
24 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
3 plan skip_all => "Coverage tests only run for authors" unless (-d 'inc/.author');
45 all_pod_files_ok();
0 use Test::More;
1 plan skip_all => "Tab tests only run for authors" unless (-d 'inc/.author');
2
3 eval "use Test::NoTabs 1.00";
4 plan skip_all => "Test::NoTabs 1.00 required for testing POD coverage" if $@;
5
6 all_perl_files_ok('lib', 't');
3232 my $rec = TestApp::User->new( handle => $handle );
3333 isa_ok($rec, 'Jifty::DBI::Record');
3434
35 my $col = $rec->column('name');
36 is($col->label, 'Name');
35 my $col = $rec->column('name');
36 is($col->label, 'Name');
3737
38 is($col->attributes->{arbitary_data}, 'fooo');
38 is($col->attributes->{arbitary_data}, 'fooo');
3939
40 is_deeply($col->serialize_metadata, { type => 'varchar', label => 'Name', sort_order => 0, writable => 1, name => 'name', readable => 1 });
40 is_deeply($col->serialize_metadata, { type => 'varchar', label => 'Name', sort_order => 0, writable => 1, name => 'name', readable => 1 });
4141
4242 cleanup_schema( 'TestApp', $handle );
4343 disconnect_handle( $handle );