def columns(table)
@db.type_translation = false
ret =
@db.table_info(table).map do |hash|
m = DBI::DBD::SQLite3.parse_type(hash['type'])
h = {
'name' => hash['name'],
'type_name' => m[1],
'sql_type' =>
begin
DBI.const_get('SQL_'+hash['type'].upcase)
rescue NameError
DBI::SQL_OTHER
end,
'nullable' => (hash['notnull'] == '0'),
'default' => (@attr['type_translation'] && (not hash['dflt_value'])) ?
@db.translator.translate(hash['type'], hash['dflt_value']) :
hash['dflt_value']
}
h['precision'] = m[3].to_i if m[3]
h['scale'] = m[5].to_i if m[5]
h
end
@db.type_translation = @attr['type_translation']
ret
end