List:MySQL and Perl« Previous MessageNext Message »
From:Christoffer Vig Date:February 10 2005 9:12am
Subject:Re: need the list of possible values of a column
View as plain text  
Hi,
You should get the values with something like

my $sth = $dbh->column_info(undef, 'your_database', 'your_table', '%');
my $row = $sth->fetchall_hashref('COLUMN_NAME');
my $listofvalues = $row->{your_columnname}->{mysql_values};
print "your set was: " . join (",", @{$listofvalues});

best regards Christoffer


On Wed, 9 Feb 2005 18:07:17 -0800, J Wermont <jwermont@stripped> wrote:
> Hi, MySQL and Perl newbie here. Please don't hurt me! :)
> 
> I'm trying to get information, from within a Perl script, about a
> column in one of my tables. It's a "set" type, and I need to know
> what the order is for the list of possible values.
> 
> Ex: I have a column called "subjects" in one of my tables, whose
> type is "set". The possible values of this column is a list that
> looks like this:
> 
> "school",
> "parent",
> "sibling",
> "friends",
> "drugs",
> "money",
> "sports",
> "movies",
> "videogames",
> "homework",
> "teachers"
> 
> How would I obtain this list from a perl script?
> 
> Thanks,
> J. Wermont
> 
> --
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe:    http://lists.mysql.com/perl?unsub=1
> 
>
Thread
need the list of possible values of a columnJ Wermont10 Feb
  • Re: need the list of possible values of a columnChristoffer Vig10 Feb