mirror of
https://github.com/postgresml/pgcat.git
synced 2026-06-01 07:29:04 +00:00
c7d6273037
* Start prepared statements * parse * Ok * optional * dont rewrite anonymous prepared stmts * Dont rewrite anonymous prep statements * hm? * prep statements * I see! * comment * Print config value * Rewrite bind and add sqlx test * fmt * ok * Fix * Fix stats * its late * clean up PREPARE
30 lines
688 B
Rust
30 lines
688 B
Rust
#[tokio::main]
|
|
async fn main() {
|
|
test_prepared_statements().await;
|
|
}
|
|
|
|
async fn test_prepared_statements() {
|
|
let pool = sqlx::postgres::PgPoolOptions::new()
|
|
.max_connections(5)
|
|
.connect("postgres://sharding_user:sharding_user@127.0.0.1:6432/sharded_db")
|
|
.await
|
|
.unwrap();
|
|
|
|
let mut handles = Vec::new();
|
|
|
|
for _ in 0..5 {
|
|
let pool = pool.clone();
|
|
let handle = tokio::task::spawn(async move {
|
|
for _ in 0..1000 {
|
|
sqlx::query("SELECT 1").fetch_all(&pool).await.unwrap();
|
|
}
|
|
});
|
|
|
|
handles.push(handle);
|
|
}
|
|
|
|
for handle in handles {
|
|
handle.await.unwrap();
|
|
}
|
|
}
|