r41938 - in /trunk/liborlite-perl: Changes META.yml debian/changelog debian/control debian/copyright debian/rules lib/ORLite.pm t/02_basics.t t/lib/Test.pm

rmayorga at users.alioth.debian.org rmayorga at users.alioth.debian.org
Sun Aug 16 06:01:25 UTC 2009


Author: rmayorga
Date: Sun Aug 16 06:01:07 2009
New Revision: 41938

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=41938
Log:
* New upstream release
* update debian/rules using dh-make-perl --refresh

Modified:
    trunk/liborlite-perl/Changes
    trunk/liborlite-perl/META.yml
    trunk/liborlite-perl/debian/changelog
    trunk/liborlite-perl/debian/control
    trunk/liborlite-perl/debian/copyright
    trunk/liborlite-perl/debian/rules
    trunk/liborlite-perl/lib/ORLite.pm
    trunk/liborlite-perl/t/02_basics.t
    trunk/liborlite-perl/t/lib/Test.pm

Modified: trunk/liborlite-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/Changes?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/Changes (original)
+++ trunk/liborlite-perl/Changes Sun Aug 16 06:01:07 2009
@@ -1,4 +1,11 @@
 Changes for Perl extension ORLite
+
+1.25 Sat 15 Aug 2009
+	- Adding base and table metadata methods to each class to support
+	  the creation of support/extension methods
+
+1.24 Sat 15 Aug 2009
+	- Adding support for an iterate method
 
 1.23 Thu 11 Jun 2009 
 	- Fixed a bug in method ->delete which deleted more than the actual

Modified: trunk/liborlite-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/META.yml?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/META.yml (original)
+++ trunk/liborlite-perl/META.yml Sun Aug 16 06:01:07 2009
@@ -32,4 +32,4 @@
   ChangeLog: http://fisheye2.atlassian.com/changelog/cpan/trunk/ORLite
   license: http://dev.perl.org/licenses/
   repository: http://svn.ali.as/cpan/trunk/ORLite
-version: 1.23
+version: 1.25

Modified: trunk/liborlite-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/changelog?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/changelog (original)
+++ trunk/liborlite-perl/debian/changelog Sun Aug 16 06:01:07 2009
@@ -1,3 +1,10 @@
+liborlite-perl (1.25-1) unstable; urgency=low
+
+  * New upstream release
+  * update debian/rules using dh-make-perl --refresh
+
+ -- Rene Mayorga <rmayorga at debian.org>  Sat, 15 Aug 2009 23:42:51 -0600
+
 liborlite-perl (1.23-1) unstable; urgency=low
 
   [ Brian Cassidy ]

Modified: trunk/liborlite-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/control?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/control (original)
+++ trunk/liborlite-perl/debian/control Sun Aug 16 06:01:07 2009
@@ -2,16 +2,14 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl (>= 5.6.0), libparams-util-perl,
- libdbd-sqlite3-perl (>= 1.25), libdbi-perl (>= 1.607),
- libtest-cpan-meta-perl, libfile-temp-perl (>= 0.20),
- libpod-simple-perl (>= 3.07), libtest-pod-perl, libtest-minimumversion-perl
+Build-Depends-Indep: libdbd-sqlite3-perl (>= 1.25), libdbi-perl (>= 1.607),
+ libfile-temp-perl (>= 0.20), libparams-util-perl (>= 0.33),
+ libpod-simple-perl (>= 3.07), libtest-cpan-meta-perl,
+ libtest-minimumversion-perl, libtest-pod-perl, perl (>= 5.10.0)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Damyan Ivanov <dmn at debian.org>, Gunnar Wolf <gwolf at debian.org>,
- Brian Cassidy <brian.cassidy at gmail.com>, 
- Rene Mayorga <rmayorga at debian.org>,
- Jaldhar H. Vyas <jaldhar at debian.org>,
- Nathan Handler <nhandler at ubuntu.com>
+ Brian Cassidy <brian.cassidy at gmail.com>, Rene Mayorga <rmayorga at debian.org>,
+ Jaldhar H. Vyas <jaldhar at debian.org>, Nathan Handler <nhandler at ubuntu.com>
 Standards-Version: 3.8.2
 Homepage: http://search.cpan.org/dist/ORLite/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/liborlite-perl/
@@ -19,9 +17,9 @@
 
 Package: liborlite-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libparams-util-perl,
- libdbd-sqlite3-perl (>= 1.25), libdbi-perl (>= 1.607),
- libfile-temp-perl (>= 0.20)
+Depends: ${misc:Depends}, ${perl:Depends}, libdbd-sqlite3-perl (>= 1.25),
+ libdbi-perl (>= 1.607), libfile-temp-perl (>= 0.20),
+ libparams-util-perl (>= 0.33), perl (>= 5.10.0)
 Description: lightweight SQLite-specific ORM
  ORLite is an object-relation system specifically for SQLite that
  follows many of the same principles as the ::Tiny series of modules and

Modified: trunk/liborlite-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/copyright?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/copyright (original)
+++ trunk/liborlite-perl/debian/copyright Sun Aug 16 06:01:07 2009
@@ -8,29 +8,29 @@
 Copyright: 2008-2009 Adam Kennedy <adamk at cpan.org>
 License-Alias: Perl
 License: Artistic | GPL-1+
-    This program is free software; you can redistribute it and/or modify it
-    under the same terms as Perl itself.
 
 Files: inc/*
 Copyright: © 2002-2009, Brian Ingerson, Audrey Tang and Adam Kennedy.
 License: GPL-1+ | Artistic
 
 Files: debian/*
-Copyright:
+Copyright: 2008, 2009, Brian Cassidy <brian.cassidy at gmail.com>
  2008, Damyan Ivanov <dmn at debian.org>
- 2009, Brian Cassidy <brian.cassidy at gmail.com>
+ 2008, Gunnar Wolf <gwolf at debian.org>
+ 2009, Jaldhar H. Vyas <jaldhar at debian.org>
  2009, Nathan Handler <nhandler at ubuntu.com>
+ 2009, Rene Mayorga <rmayorga at debian.org>
 License: Artistic | GPL-1+
 
 License: Artistic
     This program is free software; you can redistribute it and/or modify
     it under the terms of the Artistic License, which comes with Perl.
     On Debian GNU/Linux systems, the complete text of the Artistic License
-    can be found in /usr/share/common-licenses/Artistic
+    can be found in `/usr/share/common-licenses/Artistic'
 
 License: GPL-1+
     This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by 
+    it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 1, or (at your option)
     any later version.
     On Debian GNU/Linux systems, the complete text of the GNU General

Modified: trunk/liborlite-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/rules?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/rules (original)
+++ trunk/liborlite-perl/debian/rules Sun Aug 16 06:01:07 2009
@@ -1,23 +1,4 @@
 #!/usr/bin/make -f
 
-build: build-stamp
-build-stamp:
-	RELEASE_TESTING=1 dh build
-	touch $@
-
-clean:
-	dh $@
-
-install: install-stamp
-install-stamp: build-stamp
-	dh install
-	touch $@
-
-binary-arch:
-
-binary-indep: install
-	dh $@
-
-binary: binary-arch binary-indep
-
-.PHONY: binary binary-arch binary-indep install clean build
+%:
+	RELEASE_TESTING=1 dh $@

Modified: trunk/liborlite-perl/lib/ORLite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/lib/ORLite.pm?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/lib/ORLite.pm (original)
+++ trunk/liborlite-perl/lib/ORLite.pm Sun Aug 16 06:01:07 2009
@@ -15,7 +15,7 @@
 
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.23';
+	$VERSION = '1.25';
 }
 
 
@@ -108,6 +108,7 @@
 
 use strict;
 use Carp ();
+use DBI  ();
 
 my \$DBH = undef;
 
@@ -127,6 +128,10 @@
 	DBI->connect(\$_[0]->dsn);
 }
 
+sub prepare {
+	shift->dbh->prepare(\@_);
+}
+
 sub do {
 	shift->dbh->do(\@_);
 }
@@ -153,15 +158,22 @@
 
 sub selectrow_hashref {
 	shift->dbh->selectrow_hashref(\@_);
-}
-
-sub prepare {
-	shift->dbh->prepare(\@_);
 }
 
 sub pragma {
 	\$_[0]->do("pragma \$_[1] = \$_[2]") if \@_ > 2;
 	\$_[0]->selectrow_arrayref("pragma \$_[1]")->[0];
+}
+
+sub iterate {
+	my \$class = shift;
+	my \$call  = pop;
+	my \$sth   = \$class->prepare( shift );
+	\$sth->execute( \@_ );
+	while ( \$_ = \$sth->fetchrow_arrayref ) {
+		\$call->() or last;
+	}
+	\$sth->finish;
 }
 
 END_PERL
@@ -283,6 +295,10 @@
 			$code .= <<"END_PERL";
 package $table->{class};
 
+sub base { '$pkg' }
+
+sub table { '$table->{name}' }
+
 sub select {
 	my \$class = shift;
 	my \$sql   = '$sql->{select} ';
@@ -297,6 +313,20 @@
 	my \$sql   = '$sql->{count} ';
 	   \$sql  .= shift if \@_;
 	$pkg->selectrow_array( \$sql, {}, \@_ );
+}
+
+sub iterate {
+	my \$class = shift;
+	my \$call  = pop;
+	my \$sql   = '$sql->{select} ';
+	   \$sql  .= shift if \@_;
+	my \$sth   = $pkg->prepare( \$sql );
+	\$sth->execute( \@_ );
+	while ( \$_ = \$sth->fetchrow_hashref ) {
+		bless( \$_, '$table->{class}' );
+		\$call->() or last;
+	}
+	\$sth->finish;
 }
 
 END_PERL

Modified: trunk/liborlite-perl/t/02_basics.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/t/02_basics.t?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/t/02_basics.t (original)
+++ trunk/liborlite-perl/t/02_basics.t Sun Aug 16 06:01:07 2009
@@ -9,7 +9,7 @@
 	$^W = 1;
 }
 
-use Test::More tests => 51;
+use Test::More tests => 65;
 use File::Spec::Functions ':ALL';
 use t::lib::Test;
 
@@ -70,24 +70,8 @@
 is( Foo::Bar::TableOne->count, 3, 'Found 3 rows' );
 is( Foo::Bar::TableOne->count('where col2 = ?', 'bar'), 2, 'Condition count works' );
 
-# Fetch the rows (list context)
-SCOPE: {
-	my @ones = Foo::Bar::TableOne->select('order by col1');
-	is( scalar(@ones), 3, 'Got 3 objects' );
-	isa_ok( $ones[0], 'Foo::Bar::TableOne' );
-	is( $ones[0]->col1, 1,     '->col1 ok' );
-	is( $ones[0]->col2, 'foo', '->col2 ok' );
-	isa_ok( $ones[1], 'Foo::Bar::TableOne' );
-	is( $ones[1]->col1, 2,     '->col1 ok' );
-	is( $ones[1]->col2, 'bar', '->col2 ok' );
-	isa_ok( $ones[2], 'Foo::Bar::TableOne' );
-	is( $ones[2]->col1, 3,     '->col1 ok' );
-	is( $ones[2]->col2, 'bar', '->col2 ok' );
-}
-
-# Fetch the rows (scalar context)
-SCOPE: {
-	my $ones = Foo::Bar::TableOne->select('order by col1');
+sub test_ones {
+	my $ones = shift;
 	is( scalar(@$ones), 3, 'Got 3 objects' );
 	isa_ok( $ones->[0], 'Foo::Bar::TableOne' );
 	is( $ones->[0]->col1, 1,     '->col1 ok' );
@@ -98,6 +82,44 @@
 	isa_ok( $ones->[2], 'Foo::Bar::TableOne' );
 	is( $ones->[2]->col1, 3,     '->col1 ok' );
 	is( $ones->[2]->col2, 'bar', '->col2 ok' );
+
+}
+
+# Fetch the rows (list context)
+test_ones(
+	[ Foo::Bar::TableOne->select('order by col1') ]
+);
+
+# Fetch the rows (scalar context)
+test_ones(
+	scalar Foo::Bar::TableOne->select('order by col1')
+);
+
+SCOPE: {
+	# Emulate select via iterate
+	my $ones = [];
+	Foo::Bar::TableOne->iterate( 'order by col1', sub {
+		push @$ones, $_;
+	} );
+	test_ones( $ones );
+
+	# Partial fetch
+	my $short = [];
+	Foo::Bar::TableOne->iterate( 'order by col1', sub {
+		push @$short, $_;
+		return 0;
+	} );
+	is( scalar(@$short), 1, 'Found only one record' );
+	is_deeply( $short->[0], $ones->[0], 'Found the same first record' );
+
+	# Lower level equivalent
+	my $short2 = [];
+	Foo::Bar->iterate( 'select * from table_one order by col1', sub {
+		push @$short2, $_;
+		return 0;
+	} );
+	is( scalar(@$short2), 1, 'Found only one record' );
+	is_deeply( $short2->[0], [ 1, 'foo' ], 'Found correct alternative' );
 
 	# Delete one of the objects via the class delete method
 	my $rv1 = Foo::Bar::TableOne->delete('where col2 = ?', 'bar');

Modified: trunk/liborlite-perl/t/lib/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/t/lib/Test.pm?rev=41938&op=diff
==============================================================================
--- trunk/liborlite-perl/t/lib/Test.pm (original)
+++ trunk/liborlite-perl/t/lib/Test.pm Sun Aug 16 06:01:07 2009
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION @ISA @EXPORT};
 BEGIN {
-	$VERSION = '1.23';
+	$VERSION = '1.25';
 	@ISA     = 'Exporter';
 	@EXPORT  = qw{ test_db connect_ok create_ok };
 }




More information about the Pkg-perl-cvs-commits mailing list