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
- RelationshipConverter.cs
- ServiceProviders.cs
- PeerHelpers.cs
- ErrorHandlingReceiver.cs
- ResourceProperty.cs
- FrameworkContentElementAutomationPeer.cs
- MetafileHeader.cs
- TransformerConfigurationWizardBase.cs
- PairComparer.cs
- TabletDevice.cs
- UrlMappingsSection.cs
- ResourceAssociationTypeEnd.cs
- COM2PropertyPageUITypeConverter.cs
- PatternMatcher.cs
- EnumDataContract.cs
- SectionRecord.cs
- CanExecuteRoutedEventArgs.cs
- AdCreatedEventArgs.cs
- AnnotationMap.cs
- XmlTextEncoder.cs
- SettingsAttributeDictionary.cs
- DiagnosticsConfiguration.cs
- DefaultTextStore.cs
- _FtpDataStream.cs
- ProcessInfo.cs
- DataGridViewRowPrePaintEventArgs.cs
- ValidatorAttribute.cs
- XmlSerializableReader.cs
- SmtpReplyReaderFactory.cs
- ImageIndexConverter.cs
- UriExt.cs
- OdbcStatementHandle.cs
- ListItemCollection.cs
- VBIdentifierNameEditor.cs
- AtomParser.cs
- GiveFeedbackEvent.cs
- EastAsianLunisolarCalendar.cs
- Int16Storage.cs
- ExpressionSelection.cs
- DataGridrowEditEndingEventArgs.cs
- AssociationTypeEmitter.cs
- SessionEndingEventArgs.cs
- SqlDesignerDataSourceView.cs
- MenuAdapter.cs
- _LocalDataStoreMgr.cs
- MessageBox.cs
- WSHttpBindingBase.cs
- InlinedAggregationOperatorEnumerator.cs
- CodeGenerator.cs
- Int64AnimationUsingKeyFrames.cs
- QueuePathDialog.cs
- TextTreeInsertUndoUnit.cs
- DocumentViewerAutomationPeer.cs
- login.cs
- EqualityArray.cs
- ResourceSet.cs
- ObjectFullSpanRewriter.cs
- KeyBinding.cs
- BackgroundWorker.cs
- AuthenticodeSignatureInformation.cs
- XmlAnyElementAttributes.cs
- RuntimeHelpers.cs
- ControlPropertyNameConverter.cs
- ServicePointManagerElement.cs
- PagesSection.cs
- Stream.cs
- AnnotationMap.cs
- TimelineCollection.cs
- HyperLinkField.cs
- Stylesheet.cs
- CustomExpressionEventArgs.cs
- SqlXmlStorage.cs
- XmlReaderSettings.cs
- MenuAdapter.cs
- CellLabel.cs
- Vector3DAnimationBase.cs
- WeakHashtable.cs
- SolidColorBrush.cs
- CorePropertiesFilter.cs
- DataGridViewCheckBoxCell.cs
- CodeMethodReturnStatement.cs
- RouteCollection.cs
- GregorianCalendar.cs
- CodeEventReferenceExpression.cs
- SchemaImporterExtensionElement.cs
- ConfigurationStrings.cs
- QueryGenerator.cs
- XhtmlTextWriter.cs
- TextContainerHelper.cs
- _Connection.cs
- ListBoxItemAutomationPeer.cs
- LogEntryHeaderv1Deserializer.cs
- StringToken.cs
- XmlMemberMapping.cs
- BoundingRectTracker.cs
- HttpResponseInternalWrapper.cs
- XpsLiterals.cs
- ImageListStreamer.cs
- FileNotFoundException.cs
- LogFlushAsyncResult.cs