mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
feat: support calling PostgreSQL procedures with the macros
Fixes #1449 (I think). I verified that the code fixes the new test. I used INOUT in setup.sql because older versions of Postgres don't support OUT parameters.
This commit is contained in:
committed by
Austin Bonander
parent
bb2baf2183
commit
1ff6a2ac94
@@ -451,9 +451,15 @@ WHERE rngtypid = $1
|
||||
|
||||
let mut nullables = Vec::new();
|
||||
|
||||
if let Some(outputs) = &explain.plan.output {
|
||||
if let Explain::Plan(
|
||||
plan @ Plan {
|
||||
output: Some(outputs),
|
||||
..
|
||||
},
|
||||
) = &explain
|
||||
{
|
||||
nullables.resize(outputs.len(), None);
|
||||
visit_plan(&explain.plan, outputs, &mut nullables);
|
||||
visit_plan(&plan, outputs, &mut nullables);
|
||||
}
|
||||
|
||||
Ok(nullables)
|
||||
@@ -486,9 +492,13 @@ fn visit_plan(plan: &Plan, outputs: &[String], nullables: &mut Vec<Option<bool>>
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct Explain {
|
||||
#[serde(rename = "Plan")]
|
||||
plan: Plan,
|
||||
enum Explain {
|
||||
/// {"Plan": ...} -- returned for most statements
|
||||
Plan(Plan),
|
||||
/// The string "Utility Statement" -- returned for
|
||||
/// a CALL statement
|
||||
#[serde(rename = "Utility Statement")]
|
||||
UtilityStatement,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user