SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
7.02k stars 492 forks source link

Syntax error when including parenthesis in SeaORM #2246

Closed pmantica11 closed 3 months ago

pmantica11 commented 3 months ago

Description

If I include parenthesis in a SQLlite query, I get a syntax error.

Steps to Reproduce

  1. Run ( SELECT * FROM any_table ) or SELECT MAX(id) FROM any_table

Here is some example code:

    let index_stmt = Statement::from_string(
        txn.get_database_backend(),
        format!(
            "SELECT MAX (leaf_index) FROM indexed_trees",
        ),
    );
    // Get the max index from the database
    let max_index = txn
        .query_one(index_stmt)
        .await
        .map_err(|e| {
            IngesterError::DatabaseError(format!("Failed to execute max index query: {}", e))
        })?
        .ok_or(IngesterError::DatabaseError(
            "No max index found".to_string(),
        ))?;
pmantica11 commented 3 months ago

I am using version 0.10.2 of SeaORM.