Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- SynchronousChannelMergeEnumerator.cs
- FlowDocumentPaginator.cs
- SecurityContext.cs
- Font.cs
- CommonObjectSecurity.cs
- BindingContext.cs
- ReadOnlyDataSourceView.cs
- MILUtilities.cs
- ChildrenQuery.cs
- MimeParameters.cs
- Operators.cs
- DataControlHelper.cs
- DefaultAsyncDataDispatcher.cs
- TreeNodeCollection.cs
- SelectionEditingBehavior.cs
- DbBuffer.cs
- BufferedStream.cs
- DeviceContexts.cs
- QuotaExceededException.cs
- HideDisabledControlAdapter.cs
- TablePatternIdentifiers.cs
- DbSource.cs
- MeshGeometry3D.cs
- HtmlInputReset.cs
- XmlSchemaGroupRef.cs
- ScopelessEnumAttribute.cs
- PointConverter.cs
- Canvas.cs
- AlgoModule.cs
- SessionStateUtil.cs
- SignatureResourceHelper.cs
- DigestTraceRecordHelper.cs
- TreeNodeCollection.cs
- WebControlsSection.cs
- RubberbandSelector.cs
- EncryptedXml.cs
- MetadataSection.cs
- TemplateXamlTreeBuilder.cs
- LicenseProviderAttribute.cs
- Control.cs
- WaitHandle.cs
- NativeWindow.cs
- DataTable.cs
- Filter.cs
- WebPartConnectionsConfigureVerb.cs
- PermissionAttributes.cs
- TextCompositionManager.cs
- XdrBuilder.cs
- DocumentXPathNavigator.cs
- PEFileEvidenceFactory.cs
- PasswordTextContainer.cs
- Paragraph.cs
- HtmlInputControl.cs
- ThrowHelper.cs
- AuthenticationConfig.cs
- RuntimeHandles.cs
- ScrollBar.cs
- Transform3D.cs
- ArrayWithOffset.cs
- MediaElement.cs
- EndEvent.cs
- followingsibling.cs
- XmlAnyElementAttributes.cs
- SafeNativeMethods.cs
- SimpleWorkerRequest.cs
- Avt.cs
- TimeSpanConverter.cs
- Helper.cs
- DictionaryMarkupSerializer.cs
- SoapInteropTypes.cs
- DictionaryEntry.cs
- EntityStoreSchemaFilterEntry.cs
- SystemMulticastIPAddressInformation.cs
- SiteMapNodeItemEventArgs.cs
- EllipseGeometry.cs
- WinFormsComponentEditor.cs
- ImportException.cs
- ProxyGenerationError.cs
- DataViewManager.cs
- UserControlBuildProvider.cs
- DesignerMetadata.cs
- GetChildSubtree.cs
- BitmapScalingModeValidation.cs
- QueryInterceptorAttribute.cs
- QilXmlReader.cs
- InternalConfigHost.cs
- PngBitmapEncoder.cs
- HealthMonitoringSection.cs
- configsystem.cs
- AsyncOperationManager.cs
- ConfigurationLocation.cs
- FormattedText.cs
- _SSPIWrapper.cs
- ProgressChangedEventArgs.cs
- DataKeyCollection.cs
- SmtpClient.cs
- ServerType.cs
- DefaultProxySection.cs
- RSACryptoServiceProvider.cs
- PeerContact.cs