lib/dbd/mysql/database.rb
#
# Given a type name, weans some basic information from that and returns
# it in a format similar to columns.
#
# Return is an array of +sqltype+, +type+, +size+, and +decimal+.
# +sqltype+ is the XOPEN type, and +type+ is the string with the
# parameters removed.
#
# +size+ and +decimal+ refer to +precision+ and +scale+ in most cases,
# but not always for all types. Please consult the documentation for
# your MySQL version.
#
#
Given a type name, weans some basic information from that and returns
it in a format similar to columns.




Given a type name weans some basic information from that and returns it in a format similar to columns .
def mysql_type_info(typedef)
            sqltype, type, size, decimal = nil, nil, nil, nil
            pos = typedef.index('(')
            if not pos.nil?
                type = typedef[0..pos-1]
                size = typedef[pos+1..-2]
                pos = size.index(',')
                if not pos.nil?
                    size, decimal = size.split(',', 2)
                    decimal = decimal.to_i
                end
                size = size.to_i
            else
                type = typedef
            end
            type_info = MYSQL_to_XOPEN[type.upcase] || MYSQL_to_XOPEN[nil]
            sqltype = type_info[0]
            if size.nil? then size = type_info[1] end
            if decimal.nil? then decimal = type_info[2] end
            return sqltype, type, size, decimal
        end
def mysql_type_info ( typedef ) sqltype , type , size , decimal = nil , nil , nil , nil pos = typedef . index ( '(' ) if not pos . nil? type = typedef [ 0 .. pos - 1 ] size = typedef [ pos + 1 .. - 2 ] pos = size . index ( ',' ) if not pos . nil? size , decimal = size . split ( ',' , 2 ) decimal = decimal . to_i end size = size . to_i else type = typedef end type_info = MYSQL_to_XOPEN [ type . upcase ] || MYSQL_to_XOPEN [ nil ] sqltype = type_info [ 0 ] if size . nil? then size = type_info [ 1 ] end if decimal . nil? then decimal = type_info [ 2 ] end return sqltype , type , size , decimal end
Given a type name, weans some basic information from that and returns
it in a format similar to columns.
Given a type name weans some basic information from that and returns it in a format similar to columns .
typedef
<not_specific>