Light
Dark
System
v4latest
v4latest
v3
v2
v1

Execute

The execute method doesn’t return anything — a successful execute returns an Ok(()) — which is convenient for things like updates or commands where we don’t care about getting output if it works:

Copy
client.execute("update Account set {username := .username ++ '!'};", &())
  .await?;
client.execute("create superuser role project;", &())
  .await?;
client.execute("alter role project set password := 'GOODpassword';", &())
  .await?;

// Returns Ok(()) upon success but error info will be returned
let command = client.execute("create type MyType {};", &()).await;
let command_string = command.unwrap_err().to_string();
assert!(command_string.contains("bare DDL statements are not allowed"));
Light
Dark
System

We use ChatGPT with additional context from our documentation to answer your questions. Not all answers will be accurate. Please join our Discord if you need more help.