internal static List <T> SqlColumn <T>(this IDbCommand dbCmd, string sql, object anonType = null)
        {
            if (anonType != null)
            {
                dbCmd.SetParameters <T>(anonType, excludeDefaults: false);
            }
            dbCmd.CommandText = sql;

            return(IsScalar <T>()
                ? dbCmd.Column <T>()
                : dbCmd.ConvertToList <T>());
        }
        internal static List <T> Select <T>(this IDbCommand dbCmd, string sql, Dictionary <string, object> dict)
        {
            if (dict != null)
            {
                SetParameters(dbCmd, (IDictionary <string, object>)dict, (bool)false);
            }
            dbCmd.CommandText = OrmLiteConfig.DialectProvider.ToSelectStatement(typeof(T), null, sql);

            return(IsScalar <T>()
                ? dbCmd.Column <T>()
                : dbCmd.ConvertToList <T>());
        }
        internal static List <T> Select <T>(this IDbCommand dbCmd, string sql, object anonType = null)
        {
            if (anonType != null)
            {
                dbCmd.SetParameters <T>(anonType, excludeDefaults: false);
            }
            dbCmd.CommandText = OrmLiteConfig.DialectProvider.ToSelectStatement(typeof(T), null, sql);

            return(IsScalar <T>()
                ? dbCmd.Column <T>()
                : dbCmd.ConvertToList <T>());
        }
예제 #4
0
        internal static List <T> SqlColumn <T>(this IDbCommand dbCmd, string sql, Dictionary <string, object> dict)
        {
            if (dict != null)
            {
                SetParameters(dbCmd, dict, false);
            }
            dbCmd.CommandText = sql;

            return(IsScalar <T>()
                ? dbCmd.Column <T>()
                : dbCmd.ConvertToList <T>());
        }
예제 #5
0
 internal static long GetCount(this IDbCommand dbCmd, string sql, IEnumerable <IDbDataParameter> sqlParams)
 {
     return(dbCmd.Column <long>(sql, sqlParams).Sum());
 }
예제 #6
0
 internal static long GetCount(this IDbCommand dbCmd, string sql)
 {
     return(dbCmd.Column <long>(sql).Sum());
 }
 internal static List <T> ColumnFmt <T>(this IDbCommand dbCmd, string sql, params object[] sqlParams)
 {
     return(dbCmd.Column <T>(sql.SqlFmt(sqlParams)));
 }