Closed jodh-intel closed 2 years ago
@dunnderr something to think about once the db PR is merged.
Interesting suggestion @jodh-intel . Do you know if it will allow us to generate a binary that can work both with mysql and postgres? From their README, I see this comment:
// Make a simple query to return the given parameter (use a question mark `?` instead of `$1` for MySQL)
let row: (i64,) = sqlx::query_as("SELECT $1")
.bind(150_i64)
.fetch_one(&pool).await?;
If my code has to have ?
or $1
in the queries then it cannot be used as-is to connect to different databases, I think.
I think that this sounds like a good idea. I will dig into the details of sqlx to see how we can migrate to sqlx from mysql.
I just posted a pull request incorporating sqlx that leverages any to support mysql, postgres, and sqlite.
The current code requires mysql/mariadb, but if we switched to
sqlx
we'd provide a more flexible solution that supports a lot more DB servers./cc @fitzthum.