コード例 #1
0
ファイル: DropIndex.cs プロジェクト: robinreigns/IoTGateway
        /// <summary>
        /// Evaluates the node asynchronously, using the variables provided in
        /// the <paramref name="Variables"/> collection.
        /// </summary>
        /// <param name="Variables">Variables collection.</param>
        /// <returns>Result.</returns>
        public async Task <IElement> EvaluateAsync(Variables Variables)
        {
            IDataSource Source = this.source.GetSource(Variables);
            string      Name   = InsertValues.GetName(this.name, Variables);

            if (!await Source.DropIndex(Name))
            {
                throw new ScriptRuntimeException("Index not found.", this);
            }

            return(new StringValue(Name));
        }
コード例 #2
0
ファイル: CreateIndex.cs プロジェクト: robinreigns/IoTGateway
        /// <summary>
        /// Evaluates the node asynchronously, using the variables provided in
        /// the <paramref name="Variables"/> collection.
        /// </summary>
        /// <param name="Variables">Variables collection.</param>
        /// <returns>Result.</returns>
        public async Task <IElement> EvaluateAsync(Variables Variables)
        {
            IDataSource Source = this.source.GetSource(Variables);
            string      Name   = InsertValues.GetName(this.name, Variables);

            string[] Fields = new string[this.nrColumns];
            int      i;

            for (i = 0; i < this.nrColumns; i++)
            {
                string s = InsertValues.GetName(this.columns[i], Variables);
                Fields[i] = this.ascending[i] ? s : "-" + s;
            }

            await Source.CreateIndex(Name, Fields);

            return(new StringValue(Name));
        }