public static DbValue LOWER(DbFunctionTools tools, DbFunctionArguments args) { string FunctionName = "LOWER"; args.EnsureCount(FunctionName, 1); DbType arg0type; ByteSlice arg0 = args[0].Eval(out arg0type); if (Types.IsNullValue(arg0)) { return(tools.AllocNullValue()); // Give a null, take a null. } if (arg0type.ID != DbTypeID.CHARS) { args.Expected(FunctionName, 0, "input CHAR(n), got " + arg0type.Name.ToUpper()); } mstring x = tools.GetString(arg0); mstring lower = x.ToLowerM(); return(tools.AllocValue(lower)); }