public short Run()
        {
            if (string.IsNullOrEmpty(_class))
                throw new OException(OExceptionType.Query, "Class is empty");

            CommandPayload payload = new CommandPayload();
            payload.Type = CommandPayloadType.Sql;
            payload.Text = ToString();
            payload.NonTextLimit = -1;
            payload.FetchPlan = "";
            payload.SerializedParams = new byte[] { 0 };

            Command operation = new Command();
            operation.OperationMode = OperationMode.Synchronous;
            operation.ClassType = CommandClassType.NonIdempotent;
            operation.CommandPayload = payload;

            OCommandResult result = new OCommandResult(_connection.ExecuteOperation(operation));

            return short.Parse(result.ToDocument().GetField<string>("Content"));
        }
Пример #2
0
        internal IOperation CreateOperation()
        {
            CommandPayload payload = new CommandPayload();
            payload.Type = CommandPayloadType.Sql;
            payload.Text = AssignParameters(CommandText);
            payload.NonTextLimit = -1;
            payload.FetchPlan = this.IsIdempotent ? "*:0" : "";
            payload.SerializedParams = new byte[] { 0 };

            var command = new Command();
            command.OperationMode = this.IsIdempotent ? OperationMode.Asynchronous : OperationMode.Synchronous;
            command.ClassType = this.IsIdempotent ? CommandClassType.Idempotent : CommandClassType.NonIdempotent;
            command.CommandPayload = payload;
            Trace.WriteLine(payload.Text);
            return command;
        }