Skip to content

* Basic support for T-SQL query hints. #3008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

SLeopold1986
Copy link

With this patch a basic support for T-SQL query hints is provided. It is possible to use:

.WithOptions(u => u.SetHint("RECOMPILE"))

/// </summary>
/// <param name="hint">The t-sql query hint</param>
/// <returns><see langword="this" /> (for method chaining).</returns>
IQueryableOptions SetHint(string hint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface should not be changed. It is obsolete.

/// empty superclass implementation merely returns its first
/// argument.
/// </summary>
protected virtual SqlString ApplyHint(SqlString sql, string hints, Dialect.Dialect dialect)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is not used anywhere.

@@ -343,9 +351,9 @@ protected override IResultTransformer ResolveResultTransformer(IResultTransforme
Object[] resultRow = GetResultRow(row, rs, session);
bool hasTransform = HasSelectNew || resultTransformer != null;
return (!hasTransform && resultRow.Length == 1
? resultRow[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert these changes.

@@ -441,7 +449,7 @@ internal IEnumerable GetEnumerable(QueryParameters queryParameters, IEventSource
var rs = GetResultSet(cmd, queryParameters, session, null);

var resultTransformer = _selectNewTransformer ?? queryParameters.ResultTransformer;
IEnumerable result =
IEnumerable result =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this changes

@@ -62,5 +63,11 @@ public bool DefinesLimits
{
get { return maxRows != NoValue || firstRow > 0; }
}

public string Hint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strange place to add query hint...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be a better place?

@hazzik
Copy link
Member

hazzik commented Jan 30, 2022

The PR is incomplete. The hints are set, but not used by anything. And it lacks tests. We cannot accept PRs without tests

@hazzik
Copy link
Member

hazzik commented Mar 20, 2022

I'm going to close this PR as it is incomplete as far as I concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants