[Bps-public-commit] dbix-searchbuilder branch, master, updated. 1.58-5-g5d80f0c

Ruslan Zakirov ruz at bestpractical.com
Fri Nov 19 05:49:18 EST 2010


The branch, master has been updated
       via  5d80f0c0f43f31998d3a9b88e395eea784331bd7 (commit)
       via  b9722170c7eeb26e634e15313ec99d1e2cd8cc88 (commit)
       via  d07df730db69dbfb39e702f30d3e7bda00441f47 (commit)
      from  6c1d32a1cccd98fc1b72a41b877b417e13ac2c5f (commit)

Summary of changes:
 Changes               |    4 ++++
 MANIFEST              |    1 +
 META.yml              |    2 +-
 SIGNATURE             |   17 +++++++++--------
 SearchBuilder.pm      |   33 ++++++++++++++++++++++++++++-----
 t/02distinct_values.t |    8 ++++----
 6 files changed, 47 insertions(+), 18 deletions(-)

- Log -----------------------------------------------------------------
commit d07df730db69dbfb39e702f30d3e7bda00441f47
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Nov 19 13:32:33 2010 +0300

    we don't use Sort anywhere, but we have Order, keep consistency

diff --git a/SearchBuilder.pm b/SearchBuilder.pm
index 0a2e5db..41eb46b 100755
--- a/SearchBuilder.pm
+++ b/SearchBuilder.pm
@@ -582,7 +582,7 @@ sub DistinctFieldValues {
     my $self = shift;
     my %args = (
         Field  => undef,
-        Sort   => undef,
+        Order  => undef,
         Max    => undef,
         @_%2 ? (Field => @_) : (@_)
     );
@@ -594,9 +594,9 @@ sub DistinctFieldValues {
     my $column = 'main.'. $args{'Field'};
     $query_string = 'SELECT DISTINCT '. $column .' FROM '. $query_string;
 
-    if ( $args{'Sort'} ) {
+    if ( $args{'Order'} ) {
         $query_string .= ' ORDER BY '. $column
-            .' '. ($args{'Sort'} =~ /^des/i ? 'DESC' : 'ASC');
+            .' '. ($args{'Order'} =~ /^des/i ? 'DESC' : 'ASC');
     }
 
     my $dbh = $self->_Handle->dbh;
diff --git a/t/02distinct_values.t b/t/02distinct_values.t
index f5a2ef0..4458903 100644
--- a/t/02distinct_values.t
+++ b/t/02distinct_values.t
@@ -38,12 +38,12 @@ SKIP: {
 # unlimit new object and check
     $users_obj->UnLimit;
     is_deeply(
-        [$users_obj->DistinctFieldValues('GroupName', Sort => 'ASC')],
+        [$users_obj->DistinctFieldValues('GroupName', Order => 'ASC')],
         [undef, qw(boss dev sales)],
         'Correct list'
     );
     is_deeply(
-        [$users_obj->DistinctFieldValues('GroupName', Sort => 'DESC')],
+        [$users_obj->DistinctFieldValues('GroupName', Order => 'DESC')],
         [reverse undef, qw(boss dev sales)],
         'Correct list'
     );
@@ -51,12 +51,12 @@ SKIP: {
 
     $users_obj->Limit( FIELD => 'Login', OPERATOR => 'LIKE', VALUE => 'k' );
     is_deeply(
-        [$users_obj->DistinctFieldValues('GroupName', Sort => 'ASC')],
+        [$users_obj->DistinctFieldValues('GroupName', Order => 'ASC')],
         [qw(dev sales)],
         'Correct list'
     );
     is_deeply(
-        [$users_obj->DistinctFieldValues('GroupName', Sort => 'DESC')],
+        [$users_obj->DistinctFieldValues('GroupName', Order => 'DESC')],
         [reverse qw(dev sales)],
         'Correct list'
     );

commit b9722170c7eeb26e634e15313ec99d1e2cd8cc88
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Nov 19 13:43:05 2010 +0300

    document DistinctFieldValues

diff --git a/SearchBuilder.pm b/SearchBuilder.pm
index 41eb46b..80ffa1e 100755
--- a/SearchBuilder.pm
+++ b/SearchBuilder.pm
@@ -574,7 +574,30 @@ sub Last {
     return ( $self->Next );
 }
 
-=head2 DistinctColumnValues
+=head2 DistinctFieldValues
+
+Returns list with distinct values of field. Limits on collection
+are accounted, so collection should be L</UnLimit>ed to get values
+from the whole table.
+
+Takes paramhash with the following keys:
+
+=over 4
+
+=item Field
+
+Field name. Can be first argument without key.
+
+=item Order
+
+'ASC', 'DESC' or undef. Defines whether results should
+be sorted or not. By default results are not sorted.
+
+=item Max
+
+Maximum number of elements to fetch.
+
+=back
 
 =cut
 

commit 5d80f0c0f43f31998d3a9b88e395eea784331bd7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Nov 19 13:47:53 2010 +0300

    bump version, 1.59

diff --git a/Changes b/Changes
index ecb4563..10f62dc 100755
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Perl extension DBIx::SearchBuilder.
 
+1.59 Fri Nov 19 13:45:01 MSK 2010
+
+* DBIx::SearchBuilder->DistinctFieldValues method
+
 1.58 Wed Oct 20 02:17:37 MSD 2010
 
 * SIGNATURE fix
diff --git a/MANIFEST b/MANIFEST
index 168d534..406bde8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -36,6 +36,7 @@ t/01basics.t
 t/01nocap_api.t
 t/01records.t
 t/01searches.t
+t/02distinct_values.t
 t/02order_outer.t
 t/02records_cachable.t
 t/02records_integers.t
diff --git a/META.yml b/META.yml
index 608875a..999a456 100644
--- a/META.yml
+++ b/META.yml
@@ -32,4 +32,4 @@ requires:
   Want: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 1.58
+version: 1.59
diff --git a/SIGNATURE b/SIGNATURE
index 2aa0d2d..e3bc841 100644
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -15,13 +15,13 @@ not run its Makefile.PL or Build.PL.
 Hash: SHA1
 
 SHA1 1176bc1e043a0f1f11333fc4c64a5bc7e3cd4f77 .gitignore
-SHA1 e3c9f834c009301bd4c0ed8862548e9f6f6cb82f Changes
-SHA1 eb2a99b4b1d8f2515cf97d9605d66cea06114c8f MANIFEST
-SHA1 8a977dcda006155529db1fd03a6e2480080cce24 META.yml
+SHA1 94f49ca2a2e285c55b274c8897b34740cf1a5d8f Changes
+SHA1 65ec70d561d3269c548a6eeacfe832d5cbfc0d76 MANIFEST
+SHA1 f6e20473637ec59824c5e1af98e0f540e1787b65 META.yml
 SHA1 7f3870fd1159dc9ad4c1666a58d89feb0cbfae3a Makefile.PL
 SHA1 d7a41642c368f2a587587e09f9e815d434feebff README
 SHA1 5a53d12d5cccd94845a6a7cc105cd9be34e20f1c ROADMAP
-SHA1 802d88942fe506bb4084158994d38321288eb4f3 SearchBuilder.pm
+SHA1 da33893e5ddba27d4456a9aeb467fa92aafd45c9 SearchBuilder.pm
 SHA1 edd0342c7b45c8b10e4a04caf60d80454b537261 SearchBuilder/Handle.pm
 SHA1 55d337e6dd1ab5aecc39d2ae491bffb12e9ca449 SearchBuilder/Handle/Informix.pm
 SHA1 4efdcaefa5f94d994b052d1b343d2f5164ef4b52 SearchBuilder/Handle/ODBC.pm
@@ -51,6 +51,7 @@ SHA1 a7ed1ee359ebe2842b354b5652a441403e802080 t/01basics.t
 SHA1 2b2dc6f72370f60e1d233f2f8c12bb87414e825c t/01nocap_api.t
 SHA1 982a982a0e48bea88cb48cea46765e6271c508ed t/01records.t
 SHA1 d3a35118e7e04e2e8bd9d90b2ed01edb563ab829 t/01searches.t
+SHA1 74e758cce9a32fa84d0161d961c20d1d8e01a287 t/02distinct_values.t
 SHA1 af1f5d616e935cd955c2fb55c9595c8d35a3922c t/02order_outer.t
 SHA1 67d4c0dca9d1914eadba64460f3a2da4e074ae14 t/02records_cachable.t
 SHA1 e791bc2dc9ebcfe194f00eb9d0d61c391200b589 t/02records_integers.t
@@ -65,9 +66,9 @@ SHA1 e9c6a5881fc60173fbc8d479c1afd2ce3b43bef1 t/pod.t
 SHA1 afd320ea000cbe83b08691cc37bea45da20002d3 t/testmodels.pl
 SHA1 ceb2fad4e6973b7b30f0e83abc14cfb80ac93efe t/utils.pl
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.10 (Darwin)
+Version: GnuPG v1.4.11 (Darwin)
 
-iEYEARECAAYFAky+GgwACgkQvH6dkeDZaS8XGQCeNzPSaVOPiJ5kBG+xwJCZdz3b
-OAoAn32y+GHb7Bv5ropPGtJ+RAc9G7W6
-=ErdE
+iEYEARECAAYFAkzmVb4ACgkQvH6dkeDZaS86RACfX8TiwCVJr7fElS1Ar+JR3vNV
+vG0An34HlLrpietryryRnzwwZ5/mR8ij
+=oHD1
 -----END PGP SIGNATURE-----
diff --git a/SearchBuilder.pm b/SearchBuilder.pm
index 80ffa1e..b7e01e0 100755
--- a/SearchBuilder.pm
+++ b/SearchBuilder.pm
@@ -4,7 +4,7 @@ package DBIx::SearchBuilder;
 use strict;
 use warnings;
 
-our $VERSION = "1.58";
+our $VERSION = "1.59";
 
 use Clone qw();
 use Encode qw();

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list