MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / execute

Method execute

sdk-rust/src/transaction.rs:96–109  ·  view source on GitHub ↗

Execute a GQL statement within this transaction # Arguments `statement` - GQL statement to execute # Examples ```no_run # use graphlite_sdk::GraphLite; # let db = GraphLite::open("./mydb")?; # let session = db.session("admin")?; let mut tx = session.transaction()?; tx.execute("CREATE (p:Person {name: 'Alice'})")?; tx.execute("CREATE (p:Person {name: 'Bob'})")?; tx.commit()?; # Ok::<(), graphli

(&mut self, statement: &str)

Source from the content-addressed store, hash-verified

94 /// # Ok::<(), graphlite_sdk::Error>(())
95 /// ```
96 pub fn execute(&mut self, statement: &str) -> Result<()> {
97 if self.committed {
98 return Err(Error::Transaction(
99 "Transaction already committed".to_string(),
100 ));
101 }
102
103 self.session
104 .coordinator()
105 .process_query(statement, self.session.id())
106 .map_err(|e| Error::Transaction(format!("Execute failed: {}", e)))?;
107
108 Ok(())
109 }
110
111 /// Execute a query within this transaction and return results
112 ///

Callers

nothing calls this directly

Calls 4

process_queryMethod · 0.80
coordinatorMethod · 0.80
TransactionClass · 0.70
idMethod · 0.45

Tested by

no test coverage detected