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)
| 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 | /// |
nothing calls this directly
no test coverage detected