mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 07:21:08 +00:00
test: add a test case for YEAR support (as u16)
This commit is contained in:
parent
8eb8661945
commit
3840d031c6
@ -272,6 +272,30 @@ async fn it_can_bind_only_null_issue_540() -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn it_can_bind_and_return_years() -> anyhow::Result<()> {
|
||||
let mut conn = new::<MySql>().await?;
|
||||
|
||||
conn.execute(r#"
|
||||
CREATE TEMPORARY TABLE too_many_years (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
the YEAR NOT NULL
|
||||
);
|
||||
"#).await?;
|
||||
|
||||
sqlx::query(r#"
|
||||
INSERT INTO too_many_years ( the ) VALUES ( ? );
|
||||
"#).bind(2142).execute(&mut conn).await?;
|
||||
|
||||
let the: u16 = sqlx::query_scalar("SELECT the FROM too_many_years")
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
|
||||
assert_eq!(the, 2142);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn it_can_prepare_then_execute() -> anyhow::Result<()> {
|
||||
let mut conn = new::<MySql>().await?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user