1 package DBIx::DBSchema::ColGroup;
12 DBIx::DBSchema::ColGroup - Column group objects
16 use DBIx::DBSchema::ColGroup;
18 $colgroup = new DBIx::DBSchema::ColGroup ( $lol_ref );
19 $colgroup = new DBIx::DBSchema::ColGroup ( \@lol );
20 $colgroup = new DBIx::DBSchema::ColGroup (
23 [ 'multiple_columns', 'another_column', ],
27 $lol_ref = $colgroup->lol_ref;
29 @sql_lists = $colgroup->sql_list;
31 @singles = $colgroup->singles;
35 DBIx::DBSchema::ColGroup objects represent sets of sets of columns. (IOW a
36 "list of lists" - see L<perllol>.)
44 Creates a new DBIx::DBSchema::ColGroup object. Pass a reference to a list of
45 lists of column names.
50 my($proto, $lol) = @_;
52 my $class = ref($proto) || $proto;
57 bless ($self, $class);
63 Returns a reference to a list of lists of column names.
74 Returns a flat list of comma-separated values, for SQL statements.
80 [ 'multiple_columns', 'another_column', ],
83 $colgroup = new DBIx::DBSchema::ColGroup ( \@lol );
85 print join("\n", $colgroup->sql_list), "\n";
90 multiple_columns, another_column
94 sub sql_list { #returns a flat list of comman-separates lists (for sql)
96 grep $_ ne '', map join(', ', @{$_}), @{$self->{'lol'}};
101 Returns a flat list of all single item lists.
105 sub singles { #returns single-field groups as a flat list
107 #map ${$_}[0], grep scalar(@{$_}) == 1, @{$self->{'lol'}};
109 ${$_}[0] =~ /^(\w+)$/
111 or die "Illegal column ", ${$_}[0], " in colgroup!";
113 } grep scalar(@{$_}) == 1, @{$self->{'lol'}};
120 Ivan Kohler <ivan-dbix-dbschema@420.am>
124 Copyright (c) 2000 Ivan Kohler
125 Copyright (c) 2000 Mail Abuse Prevention System LLC
127 This program is free software; you can redistribute it and/or modify it under
128 the same terms as Perl itself.
134 L<DBIx::DBSchema::Table>, L<DBIx::DBSchema::ColGroup::Unique>,
135 L<DBIx::DBSchema::ColGroup::Index>, L<DBIx::DBSchema>, L<perllol>, L<perldsc>,