src/org/nutz/dao/util/Daos.java
public static int getColumnIndex(ResultSetMetaData meta, String colName) throws SQLException {
        if (meta == null)
            return 0;
        int columnCount = meta.getColumnCount();
        for (int i = 1; i <= columnCount; i++)
            if (meta.getColumnName(i).equalsIgnoreCase(colName))
                return i;
        // TODO 尝试一下meta.getColumnLabel?
        log.debugf("Can not find @Column(%s) in table/view (%s)", colName, meta.getTableName(1));
        throw Lang.makeThrow(SQLException.class, "Can not find @Column(%s)", colName);
    }
public static int getColumnIndex(ResultSetMetaData meta, String colName) throws SQLException {
        if (meta == null)
            return 0;
        int columnCount = meta.getColumnCount();
        for (int i = 1; i <= columnCount; i++)
            if (meta.getColumnName(i).equalsIgnoreCase(colName))
                return i;
        // TODO 尝试一下meta.getColumnLabel?
        log.debugf("Can not find @Column(%s) in table/view (%s)", colName, meta.getTableName(1));
        throw Lang.makeThrow(SQLException.class, "Can not find @Column(%s)", colName);
    }
public static int getColumnIndex ( ResultSetMetaData meta , String colName ) throws SQLException { if ( meta == null ) return 0 ; int columnCount = meta . getColumnCount ( ) ; for ( int i = 1 ; i <= columnCount ; i ++ ) if ( meta . getColumnName ( i ) . equalsIgnoreCase ( colName ) ) return i ; // TODO 尝试一下meta.getColumnLabel? log . debugf ( "Can not find @Column(%s) in table/view (%s)" , colName , meta . getTableName ( 1 ) ) ; throw Lang . makeThrow ( SQLException . class , "Can not find @Column(%s)" , colName ) ; }
获取colName所在的行数

@param meta
从连接中取出的ResultSetMetaData
@param colName
字段名
@return 所在的索引,如果不存在就抛出异常
@throws SQLException
指定的colName找不到
获取colName所在的行数