|
7 | 7 | use std::{error::Error, fs::read_to_string, path::Path, process::exit, rc::Rc};
|
8 | 8 |
|
9 | 9 | use futures::stream::StreamExt;
|
10 |
| -use typedb_driver::{answer::{QueryAnswer, QueryType}, Transaction, TransactionType}; |
| 10 | +use typedb_driver::{ |
| 11 | + answer::{QueryAnswer, QueryType}, |
| 12 | + TransactionType, |
| 13 | +}; |
11 | 14 |
|
12 | 15 | use crate::{
|
13 | 16 | printer::{print_document, print_row},
|
@@ -291,7 +294,8 @@ fn query_type_str(query_type: QueryType) -> &'static str {
|
291 | 294 | }
|
292 | 295 |
|
293 | 296 | fn execute_query(context: &mut ConsoleContext, query: String, logging: bool) -> Result<(), typedb_driver::Error> {
|
294 |
| - let (transaction, has_writes) = context.transaction.take().expect("Transaction query run without active transaction."); |
| 297 | + let (transaction, has_writes) = |
| 298 | + context.transaction.take().expect("Transaction query run without active transaction."); |
295 | 299 | let (transaction, result, write_succes) = context.background_runtime.run(async move {
|
296 | 300 | let result = transaction.query(query).await;
|
297 | 301 | if logging {
|
@@ -374,7 +378,7 @@ fn execute_query(context: &mut ConsoleContext, query: String, logging: bool) ->
|
374 | 378 | Ok(answer) => {
|
375 | 379 | let write_query = !matches!(answer.get_query_type(), QueryType::ReadQuery);
|
376 | 380 | (transaction, Ok(()), write_query)
|
377 |
| - }, |
| 381 | + } |
378 | 382 | Err(err) => (transaction, Err(err), false),
|
379 | 383 | }
|
380 | 384 | }
|
|
0 commit comments