Skip to content

Why does client_async cache statements? #218

@seogrady

Description

@seogrady

In the examples, it looks like you invoke insert_book().bind(&transaction, &"The Great Gatsby") multiple times. Doesn't this call prepare statement every query?

Would it be preferred to do something like this to reuse the prepared statement?

let stmt = insert_book();
stmt.bind(&transaction, &"The Great Gatsby").await.unwrap();
stmt.bind(&transaction, &String::from("Moby Dick")).await.unwrap();

Wondering what the best approach is. Should I cache insert_book(), invoke every time or cache once on db connection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions