1 package FS::dbdef_colgroup;
11 FS::dbdef_colgroup - Column group objects
15 use FS::dbdef_colgroup;
17 $colgroup = new FS::dbdef_colgroup ( $lol );
18 $colgroup = new FS::dbdef_colgroup (
21 [ 'multiple_columns', 'another_column', ],
25 @sql_lists = $colgroup->sql_list;
27 @singles = $colgroup->singles;
31 FS::dbdef_colgroup objects represent sets of sets of columns.
39 Creates a new FS::dbdef_colgroup object.
44 my($proto, $lol) = @_;
46 my $class = ref($proto) || $proto;
51 bless ($self, $class);
57 Returns a flat list of comma-separated values, for SQL statements.
61 sub sql_list { #returns a flat list of comman-separates lists (for sql)
63 grep $_ ne '', map join(', ', @{$_}), @{$self->{'lol'}};
68 Returns a flat list of all single item lists.
72 sub singles { #returns single-field groups as a flat list
74 #map ${$_}[0], grep scalar(@{$_}) == 1, @{$self->{'lol'}};
78 or die "Illegal column ", ${$_}[0], " in colgroup!";
80 } grep scalar(@{$_}) == 1, @{$self->{'lol'}};
89 L<FS::dbdef_table>, L<FS::dbdef_unique>, L<FS::dbdef_index>,
90 L<FS::dbdef_column>, L<FS::dbdef>, L<perldsc>
94 class for dealing with groups of groups of columns (used as a base class by
95 FS::dbdef_{unique,index} )
97 ivan@sisd.com 98-apr-19
99 added singles, fixed sql_list to skip empty lists ivan@sisd.com 98-jun-2
101 untaint things we're returning in sub singels ivan@sisd.com 98-jun-4
103 pod ivan@sisd.com 98-sep-24