Re: DBD::mysql retrieving column collation

Paul DuBois <[email protected]> Fri, 6 Jul 2007 08:30:10 -0500
Newsgroups gmane.comp.db.mysql.perl
Message-ID <p06240866c2b3f273b113@[192.168.1.35]>
At 6:59 AM +0100 7/6/07, John ORourke wrote:
>Paul DuBois wrote:
>>If you resort to parsing SHOW output, you might find the output of
>>SHOW COLUMNS easier to deal with, because it's in row-and-column
>>format.  SHOW FULL COLUMNS displays an additional Collation column,
>Thanks! I wasn't aware of SHOW FULL COLUMNS.
>
>However I'm now successfully using the new information_schema 
>database like this:
>
>"select data_type,collation_name from information_schema.columns 
>where table_schema=? and table_name=? and column_name=?"
>
>Then if collation_name =~/bin/  it's a binary column.

Yes, you can use information_schema if you can assume MySQL 5.0
or higher.  But your rule for determining binary string columns
is incorrect.

collation_name =~/bin/ is a non-binary column with a binary *collation*.
Not the same thing as a binary string.  Binary strings have
a data type of binary, varbinary, or blob, and the collation
is NULL.

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]