MCPcopy Create free account
hub / github.com/HFQR/xitca-web / cancel_statement

Function cancel_statement

postgres/src/statement.rs:444–470  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

442
443 #[tokio::test]
444 async fn cancel_statement() {
445 let (cli, drv) = Postgres::new("postgres://postgres:postgres@localhost:5432")
446 .connect()
447 .await
448 .unwrap();
449
450 tokio::task::spawn(drv.into_future());
451
452 std::path::Path::new("./samples/test.sql").execute(&cli).await.unwrap();
453
454 let stmt = Statement::named("SELECT id, name FROM foo ORDER BY id", &[])
455 .execute(&cli)
456 .await
457 .unwrap();
458
459 let stmt_raw = stmt.duplicate();
460
461 drop(stmt);
462
463 let mut stream = stmt_raw.query(&cli).await.unwrap();
464
465 let e = stream.try_next().await.err().unwrap();
466
467 let e = e.downcast_ref::<DbError>().unwrap();
468
469 assert_eq!(e.code(), &SqlState::INVALID_SQL_STATEMENT_NAME);
470 }
471}

Callers

nothing calls this directly

Calls 8

spawnFunction · 0.85
into_futureMethod · 0.80
dropFunction · 0.50
connectMethod · 0.45
executeMethod · 0.45
duplicateMethod · 0.45
queryMethod · 0.45
try_nextMethod · 0.45

Tested by

no test coverage detected