Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: DBD::mysql retrieving column collation

From: Paul DuBois <paul(at)mysql.com>
Date: Fri Jul 06 2007 - 10:37:16 EDT


At 5:17 PM +0300 7/6/07, Patrick Galbraith wrote:
>I don't know offhand if with DBI, you should be able to get this
>info. It seems pretty easy to add.

Presumably it would have to be a mysql_specific statement handle attribute, so it would need a mysql_ prefix. Perhaps $sth->{mysql_charset_nr}? Oops, I just checked mysql.h and there is no underscore, so it would be $sth->{mysql_charsetnr}.

If you're thinking along these lines, there are probably several other MYSQL_FIELD members that could be exposed. :-) I guess that would impact performance a bit, though.

>
>regards,
>
>Patrick
>
>Paul DuBois wrote:
>
>>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.
>>
>
>
>--
>Patrick Galbraith, Senior Programmer Grazr - Easy feed grazing and sharing
>http://www.grazr.com
>Satyam Eva Jayate - Truth Alone Triumphs
>Mundaka Upanishad

-- 
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/perl?unsub=lists@pantek.com
Received on Fri Jul 6 10:37:42 2007

This archive was generated by hypermail 2.1.8 : Fri Jul 06 2007 - 21:25:58 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library