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
- CodeDelegateInvokeExpression.cs
- EntityDataSourceView.cs
- _SslSessionsCache.cs
- validationstate.cs
- XpsFontSerializationService.cs
- CodeNamespace.cs
- UDPClient.cs
- KeyedQueue.cs
- SerializationInfoEnumerator.cs
- SimpleTypesSurrogate.cs
- WorkflowOperationBehavior.cs
- codemethodreferenceexpression.cs
- ObjectQueryExecutionPlan.cs
- DataSourceCacheDurationConverter.cs
- FormClosingEvent.cs
- NullableDoubleMinMaxAggregationOperator.cs
- EncoderReplacementFallback.cs
- BooleanAnimationBase.cs
- SqlDataSourceCache.cs
- TimeoutHelper.cs
- ImageAnimator.cs
- XmlElementAttributes.cs
- XNameTypeConverter.cs
- PointCollectionConverter.cs
- EventLogLink.cs
- FunctionQuery.cs
- ObjectDataSourceSelectingEventArgs.cs
- TypeElement.cs
- PropertiesTab.cs
- EventProviderWriter.cs
- Size.cs
- InvalidAsynchronousStateException.cs
- ThicknessConverter.cs
- FontDriver.cs
- SizeChangedEventArgs.cs
- OleCmdHelper.cs
- DataObjectCopyingEventArgs.cs
- WebRequest.cs
- DistributedTransactionPermission.cs
- InternalReceiveMessage.cs
- VisualStyleElement.cs
- TextDecorationCollection.cs
- ImportException.cs
- TTSEngineTypes.cs
- RedistVersionInfo.cs
- SafeEventLogWriteHandle.cs
- AssemblyNameProxy.cs
- GroupStyle.cs
- SmtpCommands.cs
- SymbolPair.cs
- HandlerMappingMemo.cs
- NavigatorOutput.cs
- MulticastNotSupportedException.cs
- TraceInternal.cs
- SpecialNameAttribute.cs
- InteropAutomationProvider.cs
- SafeHandle.cs
- IChannel.cs
- InputMethod.cs
- BamlStream.cs
- ClientUrlResolverWrapper.cs
- MultiPartWriter.cs
- UpdatePanelControlTrigger.cs
- HandlerWithFactory.cs
- FlatButtonAppearance.cs
- GiveFeedbackEvent.cs
- ServiceModelEnhancedConfigurationElementCollection.cs
- CompilationLock.cs
- FileDetails.cs
- SkinBuilder.cs
- RequestStatusBarUpdateEventArgs.cs
- DbProviderServices.cs
- ScheduleChanges.cs
- FactoryMaker.cs
- WorkflowQueueInfo.cs
- SettingsPropertyNotFoundException.cs
- RelatedPropertyManager.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Common.cs
- Transform.cs
- GPRECTF.cs
- WindowsGrip.cs
- UdpMessageProperty.cs
- DataListItemCollection.cs
- ResourcePermissionBase.cs
- DBPropSet.cs
- WebPartHelpVerb.cs
- XmlValidatingReaderImpl.cs
- OracleInternalConnection.cs
- StickyNoteAnnotations.cs
- Triplet.cs
- DataColumnChangeEvent.cs
- UInt64Storage.cs
- Soap.cs
- PeerContact.cs
- ClientOptions.cs
- ConfigurationPermission.cs
- PathStreamGeometryContext.cs
- DbConnectionOptions.cs
- FormViewInsertEventArgs.cs