Compare commits
2 Commits
1.0.68
...
ebb97b3509
| Author | SHA1 | Date | |
|---|---|---|---|
| ebb97b3509 | |||
| 5d18847f32 |
@ -24,21 +24,28 @@ impl DatabaseExecutor for SpiExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spi::connect(|client| {
|
pgrx::PgTryBuilder::new(|| {
|
||||||
pgrx::notice!("JSPG_SQL: {}", sql);
|
Spi::connect(|client| {
|
||||||
match client.select(sql, Some(args_with_oid.len() as i64), &args_with_oid) {
|
pgrx::notice!("JSPG_SQL: {}", sql);
|
||||||
Ok(tup_table) => {
|
match client.select(sql, Some(args_with_oid.len() as i64), &args_with_oid) {
|
||||||
let mut results = Vec::new();
|
Ok(tup_table) => {
|
||||||
for row in tup_table {
|
let mut results = Vec::new();
|
||||||
if let Ok(Some(jsonb)) = row.get::<pgrx::JsonB>(1) {
|
for row in tup_table {
|
||||||
results.push(jsonb.0);
|
if let Ok(Some(jsonb)) = row.get::<pgrx::JsonB>(1) {
|
||||||
|
results.push(jsonb.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Ok(Value::Array(results))
|
||||||
}
|
}
|
||||||
Ok(Value::Array(results))
|
Err(e) => Err(format!("SPI Query Fetch Failure: {}", e)),
|
||||||
}
|
}
|
||||||
Err(e) => Err(format!("SPI Query Fetch Failure: {}", e)),
|
})
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
.catch_others(|cause| {
|
||||||
|
pgrx::warning!("JSPG Caught Native Postgres Error: {:?}", cause);
|
||||||
|
Err(format!("{:?}", cause))
|
||||||
|
})
|
||||||
|
.execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execute(&self, sql: &str, args: Option<&[Value]>) -> Result<(), String> {
|
fn execute(&self, sql: &str, args: Option<&[Value]>) -> Result<(), String> {
|
||||||
@ -53,13 +60,20 @@ impl DatabaseExecutor for SpiExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spi::connect_mut(|client| {
|
pgrx::PgTryBuilder::new(|| {
|
||||||
pgrx::notice!("JSPG_SQL: {}", sql);
|
Spi::connect_mut(|client| {
|
||||||
match client.update(sql, Some(args_with_oid.len() as i64), &args_with_oid) {
|
pgrx::notice!("JSPG_SQL: {}", sql);
|
||||||
Ok(_) => Ok(()),
|
match client.update(sql, Some(args_with_oid.len() as i64), &args_with_oid) {
|
||||||
Err(e) => Err(format!("SPI Execution Failure: {}", e)),
|
Ok(_) => Ok(()),
|
||||||
}
|
Err(e) => Err(format!("SPI Execution Failure: {}", e)),
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.catch_others(|cause| {
|
||||||
|
pgrx::warning!("JSPG Caught Native Postgres Error: {:?}", cause);
|
||||||
|
Err(format!("{:?}", cause))
|
||||||
|
})
|
||||||
|
.execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn auth_user_id(&self) -> Result<String, String> {
|
fn auth_user_id(&self) -> Result<String, String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user