0.33
authorivan <ivan>
Fri, 29 Jun 2007 01:50:07 +0000 (01:50 +0000)
committerivan <ivan>
Fri, 29 Jun 2007 01:50:07 +0000 (01:50 +0000)
Changes
DBSchema.pm
DBSchema/Table.pm

diff --git a/Changes b/Changes
index d7cc9cb..ff6c70c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,8 +1,8 @@
 Revision history for Perl extension DBIx::DBSchema.
 
-0.33 unreleased
+0.33 Thu Jun 28 18:46:15 PDT 2007
         - Overhaul of index representation: indices (both normal and unique)
-          are now named DBIx::DBSchema::Index objects
+          now have names and are DBIx::DBSchema::Index objects
         - update_schema now handles indices!
         - Bump version numbers in Table.pm, Column.pm and DBD.pm
         - Pg reverse-engineering fix for column order in multi-column indices,
index 43baaaf..95ac630 100644 (file)
@@ -10,8 +10,8 @@ use DBIx::DBSchema::Column;
 use DBIx::DBSchema::ColGroup::Unique;
 use DBIx::DBSchema::ColGroup::Index;
 
-$VERSION = "0.33_01";
-$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
+$VERSION = "0.33";
+#$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
 
 $DEBUG = 0;
 
index 3679965..a51acc8 100644 (file)
@@ -452,6 +452,24 @@ sub indices {
     : ();
 }
 
+=item unique_singles
+
+Meet exciting and unique singles using this method!
+
+This method returns a list of column names that are indexed with their own,
+unique, non-compond (that's the "single" part) indices.
+
+=cut
+
+sub unique_singles {
+  my $self = shift;
+  my %indices = $self->indices;
+
+  map { ${ $indices{$_}->columns }[0] }
+      grep { $indices{$_}->unique && scalar(@{$indices{$_}->columns}) == 1 }
+           keys %indices;
+}
+
 =item sql_create_table [ DATABASE_HANDLE | DATA_SOURCE [ USERNAME PASSWORD [ ATTR ] ] ]
 
 Returns a list of SQL statments to create this table.