Skip to content

Instantly share code, notes, and snippets.

@isaksky

isaksky/subqueryWithLang.fs Secret

Last active Dec 16, 2016
Embed
What would you like to do?
let subQueryWithLang langParam : PrimaryExpression =
PrimaryExpression.ScalarSubquery
(None,
Some
(QueryExpression.QuerySpecification
(None,
Some
(FromClause.FromClause
[TableReference.TableReferenceWithAlias
(TableReferenceWithAlias.TableReferenceWithAliasAndColumns
(TableReferenceWithAliasAndColumns.QueryDerivedTable
(Some (Identifier.Base (ScriptDom.QuoteType.NotQuoted,Some "T")),[],
Some
(QueryExpression.BinaryQueryExpression
(true,ScriptDom.BinaryQueryExpressionType.Union,
Some
(QueryExpression.QuerySpecification
(None,
Some
(FromClause.FromClause
[TableReference.TableReferenceWithAlias
(TableReferenceWithAlias.NamedTableReference
(None,
Some
(SchemaObjectName.Base (Some (Identifier.Base (ScriptDom.QuoteType.NotQuoted, Some "translation_texts")),
1,None,
[Identifier.Base (ScriptDom.QuoteType.NotQuoted, Some "translation_texts")],
None,None)),[],
None,None))]),None,
None,None,None,
[SelectElement.SelectScalarExpression
(None,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base (1, [Identifier.Base (ScriptDom.QuoteType.NotQuoted, Some "txt")]))))));
SelectElement.SelectScalarExpression
(Some
(IdentifierOrValueExpression.IdentifierOrValueExpression
(Some
(Identifier.Base (ScriptDom.QuoteType.NotQuoted, Some "trank")),
Some "trank",None)),
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression
(ValueExpression.Literal
(Literal.IntegerLiteral (None, ScriptDom.LiteralType.Integer, Some "0"))))))],
None,ScriptDom.UniqueRowFilter.NotSpecified,
Some
(WhereClause.WhereClause
(None,
Some
(BooleanExpression.BooleanBinaryExpression
(ScriptDom.BooleanBinaryExpressionType.And,
Some
(BooleanExpression.BooleanComparisonExpression
(ScriptDom.BooleanComparisonType.Equals,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,
ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"translation_id")]))))),
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,
ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"id")]))))))),
Some
(BooleanExpression.BooleanComparisonExpression
(ScriptDom.BooleanComparisonType.Equals,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,
ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"lang")]))))),
(Some(ScalarExpression.PrimaryExpression(langParam))
(* Original
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression //INSERT HERE
(ValueExpression.VariableReference (None, Some "@lang"))) *)
))))))))),
None,None,None,
Some
(QueryExpression.QuerySpecification
(None,
Some
(FromClause.FromClause
[TableReference.TableReferenceWithAlias
(TableReferenceWithAlias.NamedTableReference
(None,
Some
(SchemaObjectName.Base
(Some
(Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"translation_texts")),
1,None,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"translation_texts")],
None,None)),[],
None,None))]),None,
None,None,None,
[SelectElement.SelectScalarExpression
(None,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some "txt")]))))));
SelectElement.SelectScalarExpression
(Some
(IdentifierOrValueExpression.IdentifierOrValueExpression
(Some
(Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some "trank")),
Some "trank",None)),
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression
(ValueExpression.Literal
(Literal.IntegerLiteral
(None,ScriptDom.LiteralType.Integer,
Some "1"))))))],
None,ScriptDom.UniqueRowFilter.NotSpecified,
Some
(WhereClause.WhereClause
(None,
Some
(BooleanExpression.BooleanBinaryExpression
(ScriptDom.BooleanBinaryExpressionType.And,
Some
(BooleanExpression.BooleanComparisonExpression
(ScriptDom.BooleanComparisonType.Equals,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,
ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"translation_id")]))))),
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression
(ValueExpression.VariableReference
(None,
Some
"@id")))))),
Some
(BooleanExpression.BooleanComparisonExpression
(ScriptDom.BooleanComparisonType.Equals,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,
ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base
(1,
[Identifier.Base
(ScriptDom.QuoteType.NotQuoted,
Some
"lang")]))))),
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression
(ValueExpression.Literal
(Literal.StringLiteral
(None,
false,
false,
ScriptDom.LiteralType.String,
Some
"en"))))))))))))))))))]),
None,None,None,
Some
(OrderByClause.OrderByClause
[ExpressionWithSortOrder.ExpressionWithSortOrder
(Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,ScriptDom.ColumnType.Regular,
Some
(MultiPartIdentifier.Base (1,[Identifier.Base (ScriptDom.QuoteType.NotQuoted,Some "trank")]))))),
ScriptDom.SortOrder.NotSpecified)]),
[SelectElement.SelectScalarExpression
(None,
Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ColumnReferenceExpression
(None,ScriptDom.ColumnType.Regular,
Some (MultiPartIdentifier.Base (1,[Identifier.Base (ScriptDom.QuoteType.NotQuoted,Some "txt")]))))))],
Some
(TopRowFilter.TopRowFilter
(Some
(ScalarExpression.PrimaryExpression
(PrimaryExpression.ValueExpression
(ValueExpression.Literal
(Literal.IntegerLiteral (None,ScriptDom.LiteralType.Integer,Some "1"))))),
false,false)),ScriptDom.UniqueRowFilter.NotSpecified,None)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment