-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SQLX unwraps internally when there are comments in the query #231
Comments
Isolated: use sqlx::{Connect, Executor};
use sqlx::sqlite::SqliteConnection;
#[tokio::main]
async fn main() {
let mut conn = SqliteConnection::connect("sqlite://test.db").await.unwrap();
conn.execute("-- comment").await.unwrap();
} Apparently I can't have comments in my queries. |
And this is not because there is no actual query (just a comment), as the same error happens when there are comments alongside normal queries. |
Interesting edge case. I would expect this to just work. |
Hi! This seems to occur when the last statement of a query is empty, as summary:
select 1; -- comment
-- comment
select 1 select 1;
-- comment
select 1;
use sqlx::{Connect, Executor};
use sqlx::sqlite::SqliteConnection;
#[async_std::main]
async fn main() {
let mut conn = SqliteConnection::connect("sqlite::memory:").await.unwrap();
conn.execute("").await.unwrap();
}
conclusion:
|
@izik1 Thanks for the detailed investigation. @PonasKovas This should be fixed on master. If you don't mind trying it out when you have a moment to see if it does indeed fix your case; that would help validate the fix. |
@mehcode Yep, everything woks now, thanks. |
Hello, my program panics because sqlx unwraps on
sqlx-core/src/sqlite/statement.rs:97:43
. No error messages or anything.I'll try to isolate the code that causes this right now, any idea what this could be?
The text was updated successfully, but these errors were encountered: