Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- AttachedPropertyBrowsableForChildrenAttribute.cs
- EditorBrowsableAttribute.cs
- DiscoveryEndpoint.cs
- Literal.cs
- DodSequenceMerge.cs
- TableHeaderCell.cs
- WebPartConnectionsCloseVerb.cs
- ChannelCacheDefaults.cs
- CollectionBase.cs
- ExceptionHandlerDesigner.cs
- BindableTemplateBuilder.cs
- OperationPerformanceCounters.cs
- RoleGroup.cs
- HttpProcessUtility.cs
- SetStoryboardSpeedRatio.cs
- RemotingSurrogateSelector.cs
- SafeNativeHandle.cs
- _UriSyntax.cs
- NumberFormatInfo.cs
- XmlSchemaAll.cs
- SqlConnectionPoolProviderInfo.cs
- ProfileModule.cs
- EntityDataSourceView.cs
- dbdatarecord.cs
- Socket.cs
- CodeTypeMemberCollection.cs
- SystemIPGlobalStatistics.cs
- SqlVisitor.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- TypeDescriptorFilterService.cs
- ParameterToken.cs
- Triplet.cs
- SingleKeyFrameCollection.cs
- InvalidAsynchronousStateException.cs
- MaskDescriptors.cs
- ThreadAttributes.cs
- DataGridViewRowsAddedEventArgs.cs
- CommandPlan.cs
- BitmapEffectDrawingContextState.cs
- HandleTable.cs
- XPathParser.cs
- CustomCategoryAttribute.cs
- SettingsAttributes.cs
- Shape.cs
- ColorConverter.cs
- AssociatedControlConverter.cs
- ToolBarTray.cs
- Activity.cs
- AccessorTable.cs
- TTSEngineProxy.cs
- ControlIdConverter.cs
- PropertyFilterAttribute.cs
- OptimalBreakSession.cs
- NoResizeHandleGlyph.cs
- CodeMemberField.cs
- WindowCollection.cs
- ConfigurationPropertyAttribute.cs
- SubclassTypeValidatorAttribute.cs
- ConnectivityStatus.cs
- OdbcCommandBuilder.cs
- CatalogZoneDesigner.cs
- ContextMarshalException.cs
- MetadataSource.cs
- SqlParameterizer.cs
- AttachedAnnotationChangedEventArgs.cs
- ReaderWriterLock.cs
- MatchAttribute.cs
- DataGridViewComponentPropertyGridSite.cs
- DeferredElementTreeState.cs
- ImageBrush.cs
- EventLogLink.cs
- WebBrowserBase.cs
- RtfToken.cs
- PlanCompiler.cs
- JavaScriptSerializer.cs
- FixedSchema.cs
- IdnMapping.cs
- ReliableMessagingVersionConverter.cs
- DesignColumn.cs
- XmlKeywords.cs
- InputEventArgs.cs
- Stream.cs
- StyleSelector.cs
- IpcPort.cs
- CustomPopupPlacement.cs
- MarkupCompiler.cs
- CodeTypeParameter.cs
- ServiceDescriptionReflector.cs
- Clause.cs
- TextTreeRootTextBlock.cs
- AstTree.cs
- EmptyEnumerator.cs
- AsymmetricKeyExchangeDeformatter.cs
- TcpChannelHelper.cs
- CheckBoxList.cs
- ListDictionaryInternal.cs
- SiteMapSection.cs
- AxImporter.cs
- NameValuePermission.cs
- SizeChangedEventArgs.cs