Re: need the list of possible values of a column

Christoffer Vig <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
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 <[email protected]> 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/[email protected]
> 
>

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.