public override string Translate(SqlCompilerContext context, SqlSelect node, SelectSection section) { switch (section) { case SelectSection.HintsEntry: return(string.Empty); case SelectSection.HintsExit: if (node.Hints.Count == 0) { return(string.Empty); } var hints = new List <string>(node.Hints.Count); foreach (SqlHint hint in node.Hints) { if (hint is SqlNativeHint) { hints.Add(QuoteIdentifier((hint as SqlNativeHint).HintText)); } } return(hints.Count > 0 ? "USE INDEX (" + string.Join(", ", hints.ToArray()) + ")" : string.Empty); default: return(base.Translate(context, node, section)); } }
/// <inheritdoc/> public override string Translate(SqlCompilerContext context, SqlSelect node, SelectSection section) { switch (section) { case SelectSection.Limit: return("FIRST"); case SelectSection.Offset: return("SKIP"); } return(base.Translate(context, node, section)); }
public override string Translate(SqlCompilerContext context, SqlSelect node, SelectSection section) { switch (section) { case SelectSection.HintsEntry: return("/*+"); case SelectSection.HintsExit: return("*/"); case SelectSection.Limit: case SelectSection.Offset: throw new NotSupportedException(); default: return(base.Translate(context, node, section)); } }
public override string Translate(SqlCompilerContext context, SqlSelect node, SelectSection section) { switch (section) { case SelectSection.Limit: return("FETCH NEXT"); case SelectSection.LimitEnd: return("ROWS ONLY"); case SelectSection.Offset: return("OFFSET"); case SelectSection.OffsetEnd: return("ROWS"); default: return(base.Translate(context, node, section)); } }
public override string Translate(SqlCompilerContext context, SqlSelect node, SelectSection section) { switch (section) { case SelectSection.Limit: return("TOP"); case SelectSection.Offset: throw new NotSupportedException(); case SelectSection.Exit: if (node.Hints.Count == 0) { return(string.Empty); } var hints = new List <string>(node.Hints.Count); foreach (var hint in node.Hints) { if (hint is SqlForceJoinOrderHint) { hints.Add("FORCE ORDER"); } else if (hint is SqlFastFirstRowsHint) { hints.Add("FAST " + (hint as SqlFastFirstRowsHint).Amount); } else if (hint is SqlNativeHint) { hints.Add((hint as SqlNativeHint).HintText); } } return(hints.Count > 0 ? "OPTION (" + string.Join(", ", hints.ToArray()) + ")" : string.Empty); } return(base.Translate(context, node, section)); }