Example #1
0
        internal override void BuildInternal()
        {
            var protobufQuery = new Protobuf.QueryBuilder.Builder();

            protobufQuery.Query = _query.QueryText;

            foreach (Parameter parameter in _query.Parameters)
            {
                Protobuf.Parameter.Builder protobufParameter = QueryParameterConverter.GetProtobufParameters(parameter);
                protobufQuery.ParametersList.Add(protobufParameter.Build());
            }

            _readQueryCommand.SetQuery(protobufQuery);



            _command.SetReadQueryCommand(_readQueryCommand);
            _command.SetType(Protobuf.Command.Types.Type.READ_QUERY);
        }
Example #2
0
        internal override void BuildInternal()
        {
            Alachisoft.NosDB.Common.Protobuf.QueryBuilder.Builder protobufQuery = new Alachisoft.NosDB.Common.Protobuf.QueryBuilder.Builder();
            Alachisoft.NosDB.Common.Protobuf.Parameter.Builder    protobufParameter;

            protobufQuery.Query = _query.QueryText;

            foreach (Parameter parameter in _query.Parameters)
            {
                //protobufParameter = new Alachisoft.NosDB.Common.Protobuf.Parameter.Builder();
                //protobufParameter.Attribute = parameter.Name;

                //if(parameter.Value == null)
                //{
                //    protobufParameter.Value = "null";
                //    protobufParameter.JsonDataType = (int)ParameterType.NULL;
                //}
                //else
                //{
                //    protobufParameter.JsonDataType = (int)DataTypeMapper.MapDataType(parameter.Value);
                //    if (protobufParameter.JsonDataType == (int)ParameterType.ARRAY || protobufParameter.JsonDataType == (int)ParameterType.OBJECT)
                //        protobufParameter.Value = JsonConvert.SerializeObject(parameter.Value);
                //    else if (protobufParameter.JsonDataType == (int)ParameterType.JSONDOCUMENT)
                //        protobufParameter.Value= parameter.Value.ToString();
                //    else
                //        protobufParameter.Value = parameter.Value.ToString();
                //}
                protobufParameter = QueryParameterConverter.GetProtobufParameters(parameter);
                protobufQuery.ParametersList.Add(protobufParameter.Build());
            }

            _writeQueryCommand.SetQuery(protobufQuery);


            base._command.SetWriteQueryCommand(_writeQueryCommand);
            base._command.SetType(Alachisoft.NosDB.Common.Protobuf.Command.Types.Type.WRITE_QUERY);
        }