getFields' :: IConnection conn
           => TypeMap
           -> conn
           -> String
           -> String
           -> IO ([(String, TypeQ)], [Int])
getFields' tmap conn scm tbl = do
    rows <- runQuery' conn (tableInfoQuerySQL scm tbl) ()
    case rows of
      [] -> compileErrorIO
            $ "getFields: No columns found: schema = " ++ scm ++ ", table = " ++ tbl
      _  -> return ()
    let columnId = TableInfo.cid
    let notNullIdxs = map (fromIntegral . columnId) . filter notNull $ rows
    putLog
        $ "getFields: num of columns = " ++ show (length rows)
        ++ ", not null columns = " ++ show notNullIdxs
    let getType' ti = case getType (fromList tmap) ti of
          Nothing -> compileErrorIO
                     $ "Type mapping is not defined against SQLite3 type: "
                     ++ normalizeType (TableInfo.ctype ti)
          Just p  -> return p
    types <- mapM getType' rows
    return (types, notNullIdxs)
getFields' :: IConnection conn
           => TypeMap
           -> conn
           -> String
           -> String
           -> IO ([(String, TypeQ)], [Int])
getFields' tmap conn scm tbl = do
    rows <- runQuery' conn (tableInfoQuerySQL scm tbl) ()
    case rows of
      [] -> compileErrorIO
            $ "getFields: No columns found: schema = " ++ scm ++ ", table = " ++ tbl
      _  -> return ()
    let columnId = TableInfo.cid
    let notNullIdxs = map (fromIntegral . columnId) . filter notNull $ rows
    putLog
        $ "getFields: num of columns = " ++ show (length rows)
        ++ ", not null columns = " ++ show notNullIdxs
    let getType' ti = case getType (fromList tmap) ti of
          Nothing -> compileErrorIO
                     $ "Type mapping is not defined against SQLite3 type: "
                     ++ normalizeType (TableInfo.ctype ti)
          Just p  -> return p
    types <- mapM getType' rows
    return (types, notNullIdxs)
getFields' tmap conn scm tbl = do
    rows <- runQuery' conn (tableInfoQuerySQL scm tbl) ()
    case rows of
      [] -> compileErrorIO
            $ "getFields: No columns found: schema = " ++ scm ++ ", table = " ++ tbl
      _  -> return ()
    let columnId = TableInfo.cid
    let notNullIdxs = map (fromIntegral . columnId) . filter notNull $ rows
    putLog
        $ "getFields: num of columns = " ++ show (length rows)
        ++ ", not null columns = " ++ show notNullIdxs
    let getType' ti = case getType (fromList tmap) ti of
          Nothing -> compileErrorIO
                     $ "Type mapping is not defined against SQLite3 type: "
                     ++ normalizeType (TableInfo.ctype ti)
          Just p  -> return p
    types <- mapM getType' rows
    return (types, notNullIdxs)