-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Microsoft.Data.Sqlite: Check error code when binding parameters #32613
Conversation
e7f8472
to
c821739
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider tagging Eric for these kind of changes
c821739
to
8a7fcc6
Compare
8a7fcc6
to
01dd417
Compare
var sqliteProvider = (ISQLite3Provider)typeof(raw) | ||
.GetProperty("Provider", BindingFlags.Static | BindingFlags.NonPublic)! | ||
.GetValue(null)!; | ||
|
||
sqliteProvider.sqlite3_limit(connection.Handle!, 0, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericsink The "sqlite3_limit" function isn't mapped by default, which is fine, but for this bug I need to call it. Is there a better way of getting hold of the "raw" functions rather than using Reflection like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean by "isn't mapped by default".
sqlite3_limit
is in my provider API and is exposed statically by the raw
class.
As a sample, my test case for the call looks like this:
[Fact]
public void test_call_sqlite3_limit()
{
using (sqlite3 db = ugly.open(":memory:"))
{
var query = raw.sqlite3_limit(db, raw.SQLITE_LIMIT_LENGTH, -1);
Assert.True(query >= 0);
const int limit = 10240;
var current = raw.sqlite3_limit(db, raw.SQLITE_LIMIT_LENGTH, limit);
Assert.Equal(query, current);
query = raw.sqlite3_limit(db, raw.SQLITE_LIMIT_LENGTH, -1);
Assert.Equal(limit, query);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericsink Thanks! I totally missed the public static methods!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. You folks are probably going through ... a transition. :-)
Tag me anytime. Tag me twice if I miss the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Eric! Appreciate it, as always.
And me! |
Fixes #27597