Show / Hide Table of Contents

Class PrivateSelect

The PrivateSelect class

Inheritance
Object
SqlCommand
PrivateSelect
ListSelect
IdxBase
Select
Implements
ICloneable
Inherited Members
SqlCommand.Origin
SqlCommand.AddIgnoreAutoSentryTableInfo(TableInfo)
SqlCommand.AddIgnoreAutoSentryTableInfo(IEnumerable<TableInfo>)
SqlCommand.RemoveIgnoreAutoSentryTableInfo(TableInfo)
SqlCommand.ClearIgnoreAutoSentryTableInfos()
SqlCommand.IsAutoSentryIgnoredOnTableInfo(TableInfo)
SqlCommand.GetPrivateSaves()
SqlCommand.GetInserts()
SqlCommand.GetUpdates()
SqlCommand.GetDeletes()
SqlCommand.GetSelect()
SqlCommand.AutoSentryIgnoredTables
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.Data.SQL
Assembly: SoDataBase.dll
Syntax
public abstract class PrivateSelect : SqlCommand, ICloneable

Constructors

PrivateSelect()

Declaration
protected PrivateSelect()

Fields

_isDistinct

The Distinct flag.

Declaration
protected bool _isDistinct
Field Value
Type Description
Boolean

Properties

ForceJoinOrder

If true, then options will be added to the generated SQL to preserv join order. Use if you know that your query suffers from bad response times as a result of bad execution plans and your join order is sound.

Declaration
public bool ForceJoinOrder { get; set; }
Property Value
Type Description
Boolean

ForceRecompile

If true, then options will be added to the generated SQL to prevent re-use of saved execution plans. Use if you know that your query suffers from bad response times as a result of execution plans being reused on parameters with wildly varying selectivity. This is quite seldom the case!

Declaration
public bool ForceRecompile { get; set; }
Property Value
Type Description
Boolean

InnerGroupBy

The Group By clause

Declaration
protected abstract GroupBy InnerGroupBy { get; }
Property Value
Type Description
GroupBy

InnerJoinRestriction

Subclasses must implement this method to allow the SuperOffice.Data.Dialect to get the JoinRestriction part of the select-statement.

Declaration
protected abstract JoinRestriction InnerJoinRestriction { get; }
Property Value
Type Description
JoinRestriction

InnerOrderBy

The Order By clause

Declaration
protected abstract OrderBy InnerOrderBy { get; }
Property Value
Type Description
OrderBy

InnerRestriction

Subclasses must implement this method to allow the SuperOffice.Data.Dialect to get the Restriction object.

Declaration
protected abstract Restriction InnerRestriction { get; }
Property Value
Type Description
Restriction

InnerReturnFields

Subclasses must implement this method to allow the SuperOffice.Data.Dialect to get the FieldInfoCollection object.

Declaration
protected abstract ReturnFieldsCollection InnerReturnFields { get; }
Property Value
Type Description
ReturnFieldsCollection

IsDistinct

Flag indicating that the Select-command is DISTINCT.

Declaration
public virtual bool IsDistinct { get; set; }
Property Value
Type Description
Boolean

SqlType

sqlType

Declaration
public override SqlType SqlType { get; }
Property Value
Type Description
SqlType
Overrides
SqlCommand.SqlType

Methods

Clone()

Declaration
public object Clone()
Returns
Type Description
Object

CloneSelect()

This partial implementation of Clone handles queries that are of SqlType Select. You'll get back an Select object.

Declaration
public Select CloneSelect()
Returns
Type Description
Select

Select object

Remarks

This implementation is based on the fact that HDB index classes inherit the PrivateSelect interface, without implementing it by actually BEING a Select. Simultaneously, we would like to treat them as the basic Select command (in cases where that is relevant).

This method will therefore create a new Select query, populate it with relevant data from itself, and return it.

Shouldn't this be ICloneable? Well - it's not a perfect clone. The main tree is copied, but the parameter values in the tree are shared. This shouldn't cause a problem since the parameter nodes are pretty close to value objects. This avoids problems with table aliasing.

Exceptions
Type Condition
SoIllegalOperationException

You will get an exception if you pass in something that is not a select query type.

CreateOrderBy()

Create a new instance of the OrderBy class.

Declaration
protected static OrderBy CreateOrderBy()
Returns
Type Description
OrderBy

New instance of the OrderBy class.

GetCachingHash()

Create a hash of the query and current identity, that can be used to identify cached query results

Declaration
public string GetCachingHash()
Returns
Type Description
String

GetRelations(TableInfo)

Get all relations that a given table is involved in.

Declaration
public RelationInfo[] GetRelations(TableInfo table)
Parameters
Type Name Description
TableInfo table

Table to get relations for.

Returns
Type Description
RelationInfo[]

All relations that the table is involved in.

GetRelations(TableInfo, SoTable)

Get all relations between a given pair of tables, where the first table is a tableinfo, and the second table is any table matching an SoTable definition

Declaration
public RelationInfo[] GetRelations(TableInfo mainTable, SoTable relatedTable)
Parameters
Type Name Description
TableInfo mainTable
SoTable relatedTable
Returns
Type Description
RelationInfo[]

GetRestrictionTables()

Get an array of TableInfo objects that correspond to the fields being used in the current Restriction. This list does NOT include restrictions that are part of a JOIN clause, only those that are part of the Restriction.

Declaration
public TableInfo[] GetRestrictionTables()
Returns
Type Description
TableInfo[]

GetTableInfos()

Get a list of all tableinfos referenced by a query, in either the return fields or joins. NOTE: Tables ONLY PRESENT IN RESTRICTION will not be returned

Declaration
public override TableInfo[] GetTableInfos()
Returns
Type Description
TableInfo[]
Overrides
SqlCommand.GetTableInfos()

GetTablesInOrderBy()

Get the TableInfos involved in orderby fields

Declaration
public TableInfo[] GetTablesInOrderBy()
Returns
Type Description
TableInfo[]

GetTablesLeadingToTable(TableInfo)

Get the tables needed for access to the target table; that is, if the target table is on the right side of some join, recursively get the table on the left side until the leftmost table is reached

Declaration
public TableInfo[] GetTablesLeadingToTable(TableInfo target)
Parameters
Type Name Description
TableInfo target
Returns
Type Description
TableInfo[]

Tables leading to the desired table, in arbitrary order; the target table is included in the result

IsTableOuterJoined(TableInfo)

Determine if the given table is the 'outer' party in at least one left outer or right outer join (inner joins by definition do not count here)

Declaration
public bool IsTableOuterJoined(TableInfo table)
Parameters
Type Name Description
TableInfo table
Returns
Type Description
Boolean

ToString()

String output.

Declaration
public override string ToString()
Returns
Type Description
String

SELECT ... FROM ... WHERE ...

Overrides
Object.ToString()

ValidateJoin()

ValidateJoin parses the join part of a sql (if there is any) and makes sure that everything is correct. We validate using 4 rules:

A) The left-hand side of the first join will be the from-table. B) If the from-table is used in the other joins, it will always live on the left-hand side. If it does not, we throw an exception. C) If the from-table isn't used in the other joins, the right-hand side will always be used in the from-part, the INNER JOIN CRM5.project T3... part. If it has been used in a right-hand side before, we throw an exception since we then will get the same tablealias twice. D) The table on the left-hand side of the join also needs to exist in the right-hand side table. If it does not live in the right-hand side table that means that the table is unknown to the sql (it hasn't been used in a from part yet ( the CRM5.project T3... part ).

Declaration
public void ValidateJoin()

Implements

System.ICloneable

Extension Methods

EnumUtil.MapEnums<From, To>(From)
QueryExectionExtensions.ExecuteReader(SqlCommand, Boolean)
QueryExectionExtensions.ExecuteScalar<T>(SqlCommand)
QueryExectionExtensions.ExecuteNonQuery(SqlCommand)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top