Beispiel #1
0
        public void GivenDoubleExtendedQueryTagFilter_WhenIELevelStudy_ValidateExtendedQueryTagFilter()
        {
            var stringBuilder = new IndentedStringBuilder(new StringBuilder());
            var includeField  = new QueryIncludeField(new List <DicomTag>());
            var queryTag      = new QueryTag(DicomTag.FloatingPointValue.BuildExtendedQueryTagStoreEntry(level: QueryTagLevel.Study));
            var filter        = new DoubleSingleValueMatchCondition(queryTag, 123D);

            filter.QueryTag = queryTag;
            var filters = new List <QueryFilterCondition>()
            {
                filter,
            };
            var query = new QueryExpression(QueryResource.AllStudies, includeField, false, 0, 0, filters, Array.Empty <string>());

            SqlParameterCollection sqlParameterCollection = CreateSqlParameterCollection();
            var parm = new SqlQueryParameterManager(sqlParameterCollection);

            new SqlQueryGenerator(stringBuilder, query, parm, SqlServer.Features.Schema.SchemaVersion.V4, DefaultPartition.Key);

            string expectedExtendedQueryTagTableFilter = @"INNER JOIN dbo.ExtendedQueryTagDouble ctd1
ON ctd1.PartitionKey = st.PartitionKey
AND ctd1.StudyKey = st.StudyKey
WHERE";

            string expectedFilters = @"AND ctd1.TagKey=@p0
AND ctd1.TagValue=@p1";

            string builtString = stringBuilder.ToString();

            Assert.Equal(queryTag.ExtendedQueryTagStoreEntry.Key.ToString(), sqlParameterCollection[0].Value.ToString());
            Assert.Equal(filter.Value.ToString(), sqlParameterCollection[1].Value.ToString());
            Assert.Contains(expectedExtendedQueryTagTableFilter, builtString);
            Assert.Contains(expectedFilters, builtString);
        }
        public override void Visit(DoubleSingleValueMatchCondition doubleSingleValueMatchCondition)
        {
            var queryTag         = doubleSingleValueMatchCondition.QueryTag;
            var dicomTagSqlEntry = DicomTagSqlEntry.GetDicomTagSqlEntry(queryTag);
            var tableAlias       = GetTableAlias(dicomTagSqlEntry, queryTag.IsExtendedQueryTag ? queryTag.ExtendedQueryTagStoreEntry.Key : null);

            _stringBuilder
            .Append("AND ");

            AppendExtendedQueryTagKeyFilter(dicomTagSqlEntry, tableAlias, doubleSingleValueMatchCondition);

            _stringBuilder
            .Append(dicomTagSqlEntry.SqlColumn, tableAlias)
            .Append("=")
            .Append(_parameters.AddParameter(dicomTagSqlEntry.SqlColumn, doubleSingleValueMatchCondition.Value))
            .AppendLine();
        }
Beispiel #3
0
 public abstract void Visit(DoubleSingleValueMatchCondition doubleSingleValueMatchCondition);