Support for prepared statements (#474)

* 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
This commit is contained in:
Lev Kokotov
2023-06-16 12:57:44 -07:00
committed by GitHub
parent 94c781881f
commit c7d6273037
14 changed files with 1954 additions and 10 deletions

View File

@@ -320,6 +320,9 @@ pub struct General {
pub auth_query: Option<String>,
pub auth_query_user: Option<String>,
pub auth_query_password: Option<String>,
#[serde(default)]
pub prepared_statements: bool,
}
impl General {
@@ -434,6 +437,7 @@ impl Default for General {
server_lifetime: Self::default_server_lifetime(),
server_round_robin: false,
validate_config: true,
prepared_statements: false,
}
}
}
@@ -1015,6 +1019,7 @@ impl Config {
"Server TLS certificate verification: {}",
self.general.verify_server_certificate
);
info!("Prepared statements: {}", self.general.prepared_statements);
info!(
"Plugins: {}",
match self.plugins {
@@ -1239,6 +1244,10 @@ pub fn get_idle_client_in_transaction_timeout() -> u64 {
.idle_client_in_transaction_timeout
}
pub fn get_prepared_statements() -> bool {
(*(*CONFIG.load())).general.prepared_statements
}
/// Parse the configuration file located at the path.
pub async fn parse(path: &str) -> Result<(), Error> {
let mut contents = String::new();