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
- MonitoringDescriptionAttribute.cs
- RegionData.cs
- PkcsUtils.cs
- DuplexSecurityProtocolFactory.cs
- WebPartManagerInternals.cs
- Lasso.cs
- EncodingInfo.cs
- WebUtility.cs
- DiscreteKeyFrames.cs
- Floater.cs
- SettingsContext.cs
- AudioBase.cs
- ObjectStateManager.cs
- SHA256Managed.cs
- TransformerConfigurationWizardBase.cs
- SynchronousChannel.cs
- ZoneMembershipCondition.cs
- ProgressPage.cs
- SafeFindHandle.cs
- MutexSecurity.cs
- METAHEADER.cs
- SqlMethodTransformer.cs
- BamlResourceDeserializer.cs
- EdmProperty.cs
- PageAsyncTaskManager.cs
- SmtpMail.cs
- TemplateColumn.cs
- BindingSource.cs
- TypedServiceOperationListItem.cs
- TypeExtension.cs
- _UncName.cs
- CodeAccessSecurityEngine.cs
- HostedAspNetEnvironment.cs
- NullableDoubleMinMaxAggregationOperator.cs
- ColorIndependentAnimationStorage.cs
- TextPointer.cs
- PrePostDescendentsWalker.cs
- RemoteWebConfigurationHostServer.cs
- FullTrustAssembly.cs
- PriorityBindingExpression.cs
- NavigationPropertyEmitter.cs
- GPRECTF.cs
- ImportCatalogPart.cs
- ListCollectionView.cs
- AllowedAudienceUriElement.cs
- LazyTextWriterCreator.cs
- RC2CryptoServiceProvider.cs
- NetworkAddressChange.cs
- CqlLexer.cs
- EarlyBoundInfo.cs
- HttpCookieCollection.cs
- TextRangeEdit.cs
- GCHandleCookieTable.cs
- URLIdentityPermission.cs
- ResourceManagerWrapper.cs
- ListControl.cs
- ColumnCollection.cs
- _PooledStream.cs
- glyphs.cs
- ZoneLinkButton.cs
- XmlElement.cs
- ResponseBodyWriter.cs
- CqlQuery.cs
- ZoomPercentageConverter.cs
- SweepDirectionValidation.cs
- DbConnectionPoolCounters.cs
- ConstraintEnumerator.cs
- Polyline.cs
- _CacheStreams.cs
- InternalRelationshipCollection.cs
- CharacterBufferReference.cs
- OAVariantLib.cs
- ErrorWebPart.cs
- FontFamilyIdentifier.cs
- XmlSchemaParticle.cs
- FixedFlowMap.cs
- HttpDebugHandler.cs
- EraserBehavior.cs
- XmlUtilWriter.cs
- TextTreeNode.cs
- TypeForwardedToAttribute.cs
- ServiceHostFactory.cs
- CatalogPartCollection.cs
- BitmapData.cs
- XamlPoint3DCollectionSerializer.cs
- EpmSourceTree.cs
- CodeTypeOfExpression.cs
- QilLoop.cs
- IndexedEnumerable.cs
- PopupControlService.cs
- AspNetSynchronizationContext.cs
- RemotingClientProxy.cs
- DmlSqlGenerator.cs
- HttpCookiesSection.cs
- LeafCellTreeNode.cs
- ScrollBar.cs
- StickyNoteContentControl.cs
- CompoundFileIOPermission.cs
- SimplePropertyEntry.cs
- EventItfInfo.cs