kurtbuilds / ormlite

An ORM in Rust for developers that love SQL.
https://crates.io/crates/ormlite
MIT License
234 stars 13 forks source link

fix: escape raw identifier #11

Closed abdulrahman1s closed 2 years ago

abdulrahman1s commented 2 years ago

fix a unexpected behavior when we use r#x

Example

#[derive(Model, FromRow)]
#[ormlite(table = "test")]
pub struct TestTable {
   r#type: i32
}

TestTable { r#type: 1 }.insert(&mut db); // INSERT INTO "test" (r#type) VALUES (?)

// The query should be "INSERT INTO "test" (type) VALUES (?)"
kurtbuilds commented 2 years ago

Can you update the PR with what problem this PR fixes? It'll help both me and anyone in the future googling the same issue. Happy to merge in with that update.

abdulrahman1s commented 2 years ago

Sure!