Comments on: How to emulate the TYPEOF() function in MySQL http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/ Stay curious! Fri, 10 May 2013 18:25:19 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15016 Xaprb Sat, 16 Aug 2008 16:57:32 +0000 http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15016 And as hoped, I found the desired information is exposed through the DBD::mysql driver. You can do a bunch of things like

$sth->{mysql_type_name}

To get an arrayref of column types for the executed statement.

]]>
By: Xaprb http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15010 Xaprb Thu, 14 Aug 2008 12:36:33 +0000 http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15010 Oh, right — before 5.1 it is named –debug-info/-T.

]]>
By: Xaprb http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15009 Xaprb Thu, 14 Aug 2008 12:35:02 +0000 http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15009 Hmm, my mysql client doesn’t have such an option. Looks like it’s new in 5.1.

]]>
By: Xaprb http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15008 Xaprb Thu, 14 Aug 2008 12:17:16 +0000 http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15008 Good to know! I was also going to dig into the DBI and DBD::mysql docs and see if there is a way to get the info from the protocol too.

]]>
By: Sergei Golubchik http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15007 Sergei Golubchik Thu, 14 Aug 2008 08:08:39 +0000 http://www.xaprb.com/blog/2008/08/13/how-to-emulate-the-typeof-function-in-mysql/#comment-15007 You can also start mysql command line client with –column-type-info (-T in old versions). It’ll show correct values as reported by the protocol.

]]>