@@ -169,7 +169,7 @@ impl<'l> QueryInterface<'l> {
self.db
.conn
.prepare(&format!(
- "INSERT INTO \"{}\" VALUES (NULL, {}) RETURNING \"id\"",
+ "INSERT INTO `{}` VALUES (NULL, {}) RETURNING \"id\"",
<T as Entity>::table_name(),
placeholders
))
@@ -93,7 +93,7 @@ where
fn derive(&self) -> DerivedQuery {
self.wrap.derive().add(
QueryPart::Where,
- format!("{} {} ?", self.col.name(), self.op.ch()),
+ format!("`{}` {} ?", self.col.name(), self.op.ch()),
)
}
@@ -41,7 +41,7 @@ impl<'r, 'q, T: Entity> QueryComponent for Update<'r, 'q, T> {
fn contribute<H: Hasher>(&self, hasher: &mut H) {
- "select".hash(hasher);
+ "update".hash(hasher);
std::any::TypeId::of::<T>().hash(hasher);
@@ -24,9 +24,9 @@ pub fn sql_for_table<T: Entity>() -> (String, String) {
(
- format!("DROP TABLE IF EXISTS \"{}\"", <T as Entity>::table_name()),
+ format!("DROP TABLE IF EXISTS `{}`", <T as Entity>::table_name()),
format!(
- "CREATE TABLE IF NOT EXISTS \"{}\" ({})",
+ "CREATE TABLE IF NOT EXISTS `{}` ({})",
columns.join(",")
),