예제 #1
0
        public override object Execute(IReadOnlyList <object> args)
        {
            if (args.Count < 3)
            {
                throw new Exception($"{Name.ToUpper()}: At least 3 argument are required.");
            }
            var blob   = ArgUtil.GetBlobArg(args[0], "array", Name);
            var index  = ArgUtil.GetInt32Arg(args[1], "element-index", Name);
            var values = new List <object>();

            for (int i = 2; i < args.Count; i++)
            {
                values.Add(args[i]);
            }
            var count = ArrayUtil.GetArrayCount(blob);

            if (index < 0 || index > count)
            {
                throw new Exception($"{Name.ToUpper()}: Argument \"element-index\" is out of range.");
            }
            else
            {
                return(ArrayUtil.SliceArrayElements(blob, index, 0, values));
            }
        }
예제 #2
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var blob     = ArgUtil.GetBlobArg(args[0], "array", Name);
            var elements = ArrayUtil.GetArrayElements(blob);

            return(string.Join("", elements));
        }
예제 #3
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var blob  = ArgUtil.GetBlobArg(args[0], "array", Name);
            var index = ArgUtil.GetInt32Arg(args[1], "element-index", Name);
            var count = ArrayUtil.GetArrayCount(blob);

            return(index < 0 || index >= count ? null : ArrayUtil.GetArrayElement(blob, index));
        }
예제 #4
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var blob  = ArgUtil.GetBlobArg(args[0], "array", Name);
            var index = ArgUtil.GetInt32Arg(args[1], "element-index", Name);
            var value = args[2];
            var count = ArrayUtil.GetArrayCount(blob);

            if (index < 0 || index >= count)
            {
                throw new Exception($"{Name.ToUpper()}: Argument \"element-index\" is out of range.");
            }
            else
            {
                return(ArrayUtil.SliceArrayElements(blob, index, 1, new[] { value }));
            }
        }
예제 #5
0
        public override object Execute(IReadOnlyList <object> args)
        {
            if (args.Count < 2)
            {
                throw new Exception($"{Name.ToUpper()}: At least 2 arguments are required.");
            }
            var values = new List <object>();

            for (int i = 0; i < args.Count; i++)
            {
                var blob       = ArgUtil.GetBlobArg(args[i], $"array #{i+1}", Name);
                var blobValues = ArrayUtil.GetArrayElements(blob);
                values.AddRange(blobValues);
            }
            return(ArrayUtil.ConvertToSqlArray(values));
        }
예제 #6
0
        public override object Execute(IReadOnlyList <object> args)
        {
            if (args.Count < 2)
            {
                throw new Exception($"{Name.ToUpper()}: At least 2 arguments are required.");
            }
            var blob   = ArgUtil.GetBlobArg(args[0], "array", Name);
            var values = new List <object>();

            for (int i = 1; i < args.Count; i++)
            {
                values.Add(args[i]);
            }
            var count = ArrayUtil.GetArrayCount(blob);

            return(ArrayUtil.SliceArrayElements(blob, count, 0, values));
        }
예제 #7
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var blob = ArgUtil.GetBlobArg(args[0], "array", Name);

            return(ArrayUtil.GetArrayCount(blob));
        }