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
- UnaryQueryOperator.cs
- DataRow.cs
- RootBrowserWindowAutomationPeer.cs
- FormViewInsertEventArgs.cs
- AuthenticationService.cs
- FlowLayoutSettings.cs
- MessageParameterAttribute.cs
- CodeTypeMemberCollection.cs
- ImagingCache.cs
- AutomationPeer.cs
- HttpCapabilitiesBase.cs
- DnsEndPoint.cs
- TextTreeUndoUnit.cs
- ListView.cs
- OdbcDataAdapter.cs
- SamlConditions.cs
- SymDocumentType.cs
- DictionaryBase.cs
- CheckBoxAutomationPeer.cs
- VBCodeProvider.cs
- InternalCache.cs
- SerializationUtilities.cs
- TrustManagerMoreInformation.cs
- RectAnimationBase.cs
- ConsumerConnectionPoint.cs
- GenericWebPart.cs
- ISCIIEncoding.cs
- TableLayoutStyleCollection.cs
- xml.cs
- ResourceWriter.cs
- EntityContainer.cs
- MergeExecutor.cs
- KoreanLunisolarCalendar.cs
- EmptyCollection.cs
- WebPartConnectionsDisconnectVerb.cs
- ComPlusDiagnosticTraceRecords.cs
- TrackingWorkflowEventArgs.cs
- HttpWebRequest.cs
- CompositeTypefaceMetrics.cs
- StreamInfo.cs
- _NativeSSPI.cs
- DefaultAsyncDataDispatcher.cs
- ToolStripDesignerAvailabilityAttribute.cs
- OracleParameter.cs
- InstancePersistence.cs
- WindowVisualStateTracker.cs
- MenuAutoFormat.cs
- CachedPathData.cs
- HttpAsyncResult.cs
- SqlDataSourceCommandEventArgs.cs
- FastEncoderStatics.cs
- SchemaImporterExtensionsSection.cs
- PolicyLevel.cs
- XmlHierarchicalDataSourceView.cs
- ButtonStandardAdapter.cs
- TableHeaderCell.cs
- TypeContext.cs
- DispatcherProcessingDisabled.cs
- RightsManagementInformation.cs
- TableLayoutCellPaintEventArgs.cs
- RectangleGeometry.cs
- SamlAttributeStatement.cs
- SessionStateContainer.cs
- ArrangedElementCollection.cs
- EmptyImpersonationContext.cs
- MutexSecurity.cs
- Stacktrace.cs
- newitemfactory.cs
- VoiceChangeEventArgs.cs
- XXXInfos.cs
- TypeListConverter.cs
- BackoffTimeoutHelper.cs
- ChangeDirector.cs
- HttpDebugHandler.cs
- ControlIdConverter.cs
- AmbiguousMatchException.cs
- XPathNodePointer.cs
- PrinterSettings.cs
- EmptyElement.cs
- GradientStop.cs
- ClaimComparer.cs
- GeneralTransform2DTo3D.cs
- httpapplicationstate.cs
- ControlIdConverter.cs
- HtmlGenericControl.cs
- GenerateTemporaryTargetAssembly.cs
- BaseTreeIterator.cs
- ParserStreamGeometryContext.cs
- RotateTransform3D.cs
- ScriptRef.cs
- Parameter.cs
- MailSettingsSection.cs
- CodeMemberProperty.cs
- ErrorReporting.cs
- HttpConfigurationContext.cs
- AvTraceFormat.cs
- DependencyStoreSurrogate.cs
- ConfigurationLockCollection.cs
- ResourceExpression.cs
- DocumentPaginator.cs