Gossamer Forum
Home : Products : DBMan SQL : Discussion :

what is column "pos"?

Quote Reply
what is column "pos"?
in the routine that displays records, it refers to ordered_columns. i found the code that sorts the columns by the "pos" which i think i found in the .def file. can the pos in the def files be changed without affecting the data?

Code:
sub ordered_columns {
# -----------------------------------------------------------
# $obj->ordered_columns;
# ----------------------
# Returns the current table columns ordered
# in function of the "pos" type of a given
# column.
#
# The columns having no specified pos are
# appended in lexicographical order at the
# end of the result array.
#
my $self = shift;
my @cols = ();
my @append = ();
my $cols = $self->{schema}->{cols};
foreach my $col (sort {
$cols->{$a}->{pos} && $cols->{$b}->{pos} ? $cols->{$a}->{pos} <=> $cols->{$b}->{pos} :
$cols->{$a}->{pos} && !$cols->{$b}->{pos} ? -1 :
$cols->{$b}->{pos} && !$cols->{$a}->{pos} ? 1 :
($a cmp $b)
} keys %{$cols}) {
push @cols, $col;
}

return @cols;
}
Subject Author Views Date
Thread what is column "pos"? delicia 5067 Jun 30, 2011, 2:28 PM
Post Re: [delicia] what is column "pos"?
Andy 4834 Jul 12, 2011, 10:23 AM