Skip to content

Sqlite: Support uninitialized EXPLAIN queries #19630

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 8, 2020

Conversation

AlexanderTaeschner
Copy link
Contributor

We ignore now when paramters are not initialized in case a EXPLAIN query is used.

Fixes #16647

@bricelam bricelam self-assigned this Jan 18, 2020
@bricelam
Copy link
Contributor

Blocked on ericsink/SQLitePCL.raw#328

@AlexanderTaeschner
Copy link
Contributor Author

My local build shows that the corresponding tests in Microsoft.Data.Sqlite.winsqlite3.Tests fail with an exception: System.EntryPointNotFoundException : Unable to find an entry point named 'sqlite3_stmt_isexplain' in DLL 'winsqlite3'. Should I guard the use of sqlite3_stmt_isexplain with a try ... catch(EntryPointNotFoundException) and use the text comparison if this occurs?

@bricelam
Copy link
Contributor

bricelam commented May 1, 2020

No text comparison. Maybe something like this:

if (sqlite3_libversion_number() < 3028000
    || sqlite3_stmt_isexplain(stmt) == 0)
{
    // throw missing parameters
}

@bricelam

This comment has been minimized.

@bricelam
Copy link
Contributor

bricelam commented May 1, 2020

Or better yet, just change the assertion:

if (new Version(connection.ServerVersion) < new Version(3, 28, 0))
{
    Assert.Throws<InvlidOperationException>(
        () => command.ExecuteScalar()));
}
else
{
    Assert.NotNull(command.ExecuteScalar());
}

@bricelam
Copy link
Contributor

bricelam commented May 7, 2020

(Rebased on master and squashed)

@bricelam bricelam merged commit 47f4630 into dotnet:master May 8, 2020
@bricelam
Copy link
Contributor

bricelam commented May 8, 2020

Thanks, @AlexanderTaeschner!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLITE: EXPLAIN requires adding values for all query's parameters
3 participants