示例#1
0
        public static SqlRequest InvokeScalarFunction(this IDbTest test, string functionName, string schema = null, params SqlParameter[] parameters)
        {
            var sql        = new StringBuilder($"Select {(!string.IsNullOrEmpty(schema) ? $"{schema}." : "")}{functionName}(");
            var firstParam = true;

            foreach (var p in parameters)
            {
                if (firstParam)
                {
                    firstParam = false;
                }
                else
                {
                    sql.Append(", ");
                }

                sql.Append(p.ParameterName);
            }

            sql.Append(") as RetVal");

            return(SqlRequest.RunSqlText(sql.ToString(), parameters));
        }
示例#2
0
 public static SqlRequest RunSqlText(this IDbTest test, string sql = null, params SqlParameter[] parameters)
 {
     return(SqlRequest.RunSqlText(sql, parameters));
 }