1 package FS::dbdef_colgroup;
10 FS::dbdef_colgroup - Column group objects
14 use FS::dbdef_colgroup;
16 $colgroup = new FS::dbdef_colgroup ( $lol );
17 $colgroup = new FS::dbdef_colgroup (
20 [ 'multiple_columns', 'another_column', ],
24 @sql_lists = $colgroup->sql_list;
26 @singles = $colgroup->singles;
30 FS::dbdef_colgroup objects represent sets of sets of columns.
38 Creates a new FS::dbdef_colgroup object.
43 my($proto, $lol) = @_;
45 my $class = ref($proto) || $proto;
50 bless ($self, $class);
56 Returns a flat list of comma-separated values, for SQL statements.
60 sub sql_list { #returns a flat list of comman-separates lists (for sql)
62 grep $_ ne '', map join(', ', @{$_}), @{$self->{'lol'}};
67 Returns a flat list of all single item lists.
71 sub singles { #returns single-field groups as a flat list
73 #map ${$_}[0], grep scalar(@{$_}) == 1, @{$self->{'lol'}};
77 or die "Illegal column ", ${$_}[0], " in colgroup!";
79 } grep scalar(@{$_}) == 1, @{$self->{'lol'}};
88 L<FS::dbdef_table>, L<FS::dbdef_unique>, L<FS::dbdef_index>,
89 L<FS::dbdef_column>, L<FS::dbdef>, L<perldsc>
93 class for dealing with groups of groups of columns (used as a base class by
94 FS::dbdef_{unique,index} )
96 ivan@sisd.com 98-apr-19
98 added singles, fixed sql_list to skip empty lists ivan@sisd.com 98-jun-2
100 untaint things we're returning in sub singels ivan@sisd.com 98-jun-4
102 pod ivan@sisd.com 98-sep-24