Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Query / PlanCompiler / PlanCompilerUtil.cs / 1 / PlanCompilerUtil.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System; using md = System.Data.Metadata.Edm; using System.Data.Query.InternalTrees; namespace System.Data.Query.PlanCompiler { ////// Utility class for the methods shared among the plan compiler components /// internal static class PlanCompilerUtil { ////// Utility method that determines whether a given CaseOp subtree can be optimized. /// Called by both PreProcessor and NominalTypeEliminator. /// /// If the case statement is of the shape: /// case when X then NULL else Y, or /// case when X then Y else NULL, /// where Y is of row type, and the types of the input CaseOp, the NULL and Y are the same, /// return true /// /// /// ///internal static bool IsRowTypeCaseOpWithNullability(CaseOp op, Node n, out bool thenClauseIsNull) { thenClauseIsNull = false; //any default value will do if (!md.TypeSemantics.IsRowType(op.Type)) { return false; } if (n.Children.Count != 3) { return false; } //All three types must be equal if (!n.Child1.Op.Type.EdmEquals(op.Type) || !n.Child2.Op.Type.EdmEquals(op.Type)) { return false; } //At least one of Child1 and Child2 needs to be a null if (n.Child1.Op.OpType == OpType.Null) { thenClauseIsNull = true; return true; } if (n.Child2.Op.OpType == OpType.Null) { // thenClauseIsNull stays false return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System; using md = System.Data.Metadata.Edm; using System.Data.Query.InternalTrees; namespace System.Data.Query.PlanCompiler { ////// Utility class for the methods shared among the plan compiler components /// internal static class PlanCompilerUtil { ////// Utility method that determines whether a given CaseOp subtree can be optimized. /// Called by both PreProcessor and NominalTypeEliminator. /// /// If the case statement is of the shape: /// case when X then NULL else Y, or /// case when X then Y else NULL, /// where Y is of row type, and the types of the input CaseOp, the NULL and Y are the same, /// return true /// /// /// ///internal static bool IsRowTypeCaseOpWithNullability(CaseOp op, Node n, out bool thenClauseIsNull) { thenClauseIsNull = false; //any default value will do if (!md.TypeSemantics.IsRowType(op.Type)) { return false; } if (n.Children.Count != 3) { return false; } //All three types must be equal if (!n.Child1.Op.Type.EdmEquals(op.Type) || !n.Child2.Op.Type.EdmEquals(op.Type)) { return false; } //At least one of Child1 and Child2 needs to be a null if (n.Child1.Op.OpType == OpType.Null) { thenClauseIsNull = true; return true; } if (n.Child2.Op.OpType == OpType.Null) { // thenClauseIsNull stays false return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ModelItemKeyValuePair.cs
- ToolBarPanel.cs
- Compilation.cs
- LexicalChunk.cs
- PropertyRecord.cs
- SqlBulkCopyColumnMappingCollection.cs
- SortDescription.cs
- JulianCalendar.cs
- altserialization.cs
- BufferedStream.cs
- CodeMethodInvokeExpression.cs
- LinqDataSourceSelectEventArgs.cs
- EntityClassGenerator.cs
- InfoCardSymmetricAlgorithm.cs
- EntityClientCacheEntry.cs
- LocationSectionRecord.cs
- HtmlInputButton.cs
- ContainsRowNumberChecker.cs
- CodeValidator.cs
- UnconditionalPolicy.cs
- CqlQuery.cs
- LogStore.cs
- XPathSingletonIterator.cs
- BoundField.cs
- HijriCalendar.cs
- FileRecordSequence.cs
- CommonDialog.cs
- UIElementPropertyUndoUnit.cs
- IsolatedStorageException.cs
- dataobject.cs
- CodeIndexerExpression.cs
- RegexGroupCollection.cs
- ClaimTypeElementCollection.cs
- MouseEvent.cs
- prefixendpointaddressmessagefilter.cs
- Link.cs
- NetworkInformationPermission.cs
- XmlCustomFormatter.cs
- FilterableAttribute.cs
- LicenseException.cs
- KeyValueSerializer.cs
- RedistVersionInfo.cs
- CompiledXpathExpr.cs
- ToolStripOverflowButton.cs
- SiteOfOriginPart.cs
- LoadRetryStrategyFactory.cs
- Encoder.cs
- DispatcherExceptionFilterEventArgs.cs
- ContainerSelectorGlyph.cs
- ExpressionBinding.cs
- BuildProvidersCompiler.cs
- OptimisticConcurrencyException.cs
- CompatibleIComparer.cs
- FixedPage.cs
- VectorAnimationUsingKeyFrames.cs
- SecurityHeader.cs
- IdentityReference.cs
- SimpleApplicationHost.cs
- _NativeSSPI.cs
- BindingContext.cs
- FilterQuery.cs
- PageWrapper.cs
- SchemaElementLookUpTable.cs
- SafeHandles.cs
- StrokeCollection.cs
- InputLanguageSource.cs
- AudioSignalProblemOccurredEventArgs.cs
- DBCommandBuilder.cs
- safesecurityhelperavalon.cs
- StaticDataManager.cs
- _DigestClient.cs
- TextRangeEditTables.cs
- CurrentTimeZone.cs
- SecurityContext.cs
- IndexOutOfRangeException.cs
- FolderBrowserDialog.cs
- SspiNegotiationTokenProvider.cs
- ConstantSlot.cs
- SqlProvider.cs
- GroupItem.cs
- LayoutInformation.cs
- ValueQuery.cs
- Base64Stream.cs
- Thread.cs
- ServicePointManager.cs
- EntityDataSourceDesigner.cs
- CodeVariableReferenceExpression.cs
- DataObjectCopyingEventArgs.cs
- WebConfigurationManager.cs
- RadioButton.cs
- ResourceManagerWrapper.cs
- ToolStripControlHost.cs
- FileSecurity.cs
- ConfigurationElementProperty.cs
- EntityWithChangeTrackerStrategy.cs
- PrivateFontCollection.cs
- FormatterServices.cs
- TransactionFilter.cs
- DiscriminatorMap.cs
- relpropertyhelper.cs