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
- MdiWindowListItemConverter.cs
- MenuItem.cs
- WebConfigurationManager.cs
- TextBoxView.cs
- SizeIndependentAnimationStorage.cs
- ItemsControlAutomationPeer.cs
- TypeUtil.cs
- AuthenticatingEventArgs.cs
- TextParentUndoUnit.cs
- CFStream.cs
- SQlBooleanStorage.cs
- ClockController.cs
- ADConnectionHelper.cs
- StringSorter.cs
- ManipulationDeltaEventArgs.cs
- OleDragDropHandler.cs
- WebRequestModulesSection.cs
- SqlDataSourceEnumerator.cs
- SqlCaseSimplifier.cs
- Asn1Utilities.cs
- PasswordDeriveBytes.cs
- RequestSecurityToken.cs
- WFItemsToSpacerVisibility.cs
- PageContentAsyncResult.cs
- TransactionProxy.cs
- DataExchangeServiceBinder.cs
- ThreadAttributes.cs
- ComboBoxRenderer.cs
- FilteredDataSetHelper.cs
- ImplicitInputBrush.cs
- HtmlHead.cs
- FlagsAttribute.cs
- LicenseException.cs
- altserialization.cs
- VoiceInfo.cs
- BatchServiceHost.cs
- EdmFunction.cs
- SecurityPolicySection.cs
- _Rfc2616CacheValidators.cs
- TemplateBamlTreeBuilder.cs
- KerberosTokenFactoryCredential.cs
- ProfessionalColors.cs
- GeometryCollection.cs
- BuildManagerHost.cs
- ADConnectionHelper.cs
- WebPageTraceListener.cs
- FilteredDataSetHelper.cs
- Line.cs
- Span.cs
- ControlTemplate.cs
- GridViewColumnHeaderAutomationPeer.cs
- XmlNamedNodeMap.cs
- ExpressionEditorAttribute.cs
- TypeGeneratedEventArgs.cs
- ProcessModelInfo.cs
- FixUpCollection.cs
- MemoryStream.cs
- SqlGenerator.cs
- Codec.cs
- WebAdminConfigurationHelper.cs
- ColumnWidthChangingEvent.cs
- DiffuseMaterial.cs
- MissingMemberException.cs
- MouseBinding.cs
- SubstitutionDesigner.cs
- WebPartConnectionsCancelVerb.cs
- ThreadStartException.cs
- AutomationProperties.cs
- XmlSchemaGroupRef.cs
- MetadataSerializer.cs
- ResizeBehavior.cs
- FontTypeConverter.cs
- PageRanges.cs
- SQLDecimal.cs
- WebPartDescription.cs
- RoleManagerSection.cs
- BamlBinaryWriter.cs
- AspNetHostingPermission.cs
- InternalCache.cs
- GlyphRunDrawing.cs
- ServiceDeploymentInfo.cs
- DelegatingConfigHost.cs
- InstanceContext.cs
- CollectionBuilder.cs
- ConfigXmlDocument.cs
- FormsAuthenticationUser.cs
- DocumentEventArgs.cs
- StringSource.cs
- EventWaitHandleSecurity.cs
- DocumentCollection.cs
- DataSpaceManager.cs
- TimelineGroup.cs
- SQLBoolean.cs
- SchemaDeclBase.cs
- GraphicsPathIterator.cs
- SparseMemoryStream.cs
- StrongNameKeyPair.cs
- Overlapped.cs
- EventWaitHandleSecurity.cs
- DataTableMapping.cs