Пример #1
0
        private void InsertOpenTypeFiltersWhenRhs(object val)
        {
            OpenTypePropertySqlMetaData openTypePropertySqlMetaDatum = this.m_OpenTypeProperties.Pop();
            string sqlTypeForClrType = ExpressionUtility.GetSqlTypeForClrType(val.GetType());
            string str = string.Format("( CASE WHEN ( Data.exist('(/Properties/{0})[1]') = 1 ) THEN", openTypePropertySqlMetaDatum.PropertyName);

            str = string.Concat(str, string.Format("\n {0} THEN", this.GetCaseStatementToCheckSqlType(openTypePropertySqlMetaDatum.PropertyName, sqlTypeForClrType)));
            str = string.Concat(str, string.Format("\n Data.value('(/Properties/{0})[1]','{1}' )", openTypePropertySqlMetaDatum.PropertyName, sqlTypeForClrType));
            str = string.Concat(str, " END END)");
            this.PartialClause.Insert(openTypePropertySqlMetaDatum.QueryIndex, str);
        }
Пример #2
0
        private void InsertOpenTypeFilters(object val, string sqlParam)
        {
            OpenTypePropertySqlMetaData sqlQueryExpressionOperator = this.m_OpenTypeProperties.Pop();
            string sqlTypeForClrType = ExpressionUtility.GetSqlTypeForClrType(val.GetType());
            string str = string.Format("( 1 = CASE WHEN ( Data.exist('(/Properties/{0})[1]') = 1 ) THEN", sqlQueryExpressionOperator.PropertyName);

            str = string.Concat(str, string.Format("\n {0} THEN", this.GetCaseStatementToCheckSqlType(sqlQueryExpressionOperator.PropertyName, sqlTypeForClrType)));
            if (sqlQueryExpressionOperator.ComparisonOperator == null)
            {
                sqlQueryExpressionOperator.ComparisonOperator = this.GetSqlQueryExpressionOperator(ExpressionType.Equal);
            }
            object[] propertyName = new object[] { sqlQueryExpressionOperator.PropertyName, sqlTypeForClrType, sqlQueryExpressionOperator.ComparisonOperator, sqlParam };
            str = string.Concat(str, string.Format("\n CASE WHEN ( Data.value('(/Properties/{0})[1]','{1}') {2} {3} ) THEN 1 ELSE 0", propertyName));
            str = string.Concat(str, " END END END )");
            this.PartialClause.Insert(sqlQueryExpressionOperator.QueryIndex, str);
        }
Пример #3
0
        private void ProcessBinaryExpressionOperator(ExpressionType nodeType)
        {
            OpenTypePropertySqlMetaData openTypePropertySqlMetaDatum;

            if (this.m_OpenTypeProperties.Count > 0)
            {
                openTypePropertySqlMetaDatum = this.m_OpenTypeProperties.Peek();
            }
            else
            {
                openTypePropertySqlMetaDatum = null;
            }
            OpenTypePropertySqlMetaData openTypePropertySqlMetaDatum1 = openTypePropertySqlMetaDatum;
            string sqlQueryExpressionOperator = this.GetSqlQueryExpressionOperator(nodeType);

            if (openTypePropertySqlMetaDatum1 != null)
            {
                openTypePropertySqlMetaDatum1.ComparisonOperator = sqlQueryExpressionOperator;
                return;
            }
            this.PartialClause.Append(string.Concat(" ", sqlQueryExpressionOperator, " "));
        }
Пример #4
0
        protected void ProcessMemberAccess(string propertyName)
        {
            if (this.m_processingState != ProcessingState.Where)
            {
                if (this.m_processingState != ProcessingState.OrderBy)
                {
                    throw new NotSupportedException("The GetValue method call is only supported for 'Where' and 'OrderBy'");
                }
                if (this.m_orderByCount == 0 && propertyName != "PartitionKey" || this.m_orderByCount == 1 && propertyName != "RowKey" || this.m_orderByCount >= 2)
                {
                    throw new NotSupportedException("OrderBy is not supported.");
                }
                this.PartialClause.Append(propertyName);
                this.m_orderByCount++;
                this.isKeyAccess = true;
                return;
            }
            this.pointQueryTracker.AddKey(propertyName);
            string str  = propertyName;
            string str1 = str;

            if (str != null && (str1 == "PartitionKey" || str1 == "RowKey" || str1 == "Timestamp"))
            {
                this.PartialClause.Append(propertyName);
                this.isKeyAccess = true;
                return;
            }
            Stack <OpenTypePropertySqlMetaData> mOpenTypeProperties          = this.m_OpenTypeProperties;
            OpenTypePropertySqlMetaData         openTypePropertySqlMetaDatum = new OpenTypePropertySqlMetaData()
            {
                QueryIndex   = this.PartialClause.Length,
                PropertyName = propertyName
            };

            mOpenTypeProperties.Push(openTypePropertySqlMetaDatum);
            this.isKeyAccess = false;
        }