Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add raw_execute outside of select #210

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Conversation

chaseWillden
Copy link
Collaborator

The previous implementations only allow for selecting. This implementation allows for all other SQL query types:

#[test]
fn execute_raw_sql() {
    let db_relative_path = "./db/insert.db";
    let db_path = Path::new(&db_relative_path);
    let conn = sqlite::open(db_path).unwrap();

    let sql = sql! {
        INSERT INTO users (username, email, address)
        VALUES
            ("raw_execute", "[email protected]", "raw_execute_address");

        DELETE FROM users
        WHERE username = "raw_execute";
    };

    let results = sqlite::raw_execute(&conn, &sql);

    assert!(!results.is_err());
}

Copy link
Member

@mjovanc mjovanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mjovanc mjovanc merged commit a1645fb into master Nov 20, 2024
5 checks passed
@mjovanc mjovanc deleted the raw-execute-outside-select branch November 20, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants