summaryrefslogtreecommitdiff
path: root/src/commit
diff options
context:
space:
mode:
Diffstat (limited to 'src/commit')
-rw-r--r--src/commit/models.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/commit/models.rs b/src/commit/models.rs
index 2f1536b..b2aa2d2 100644
--- a/src/commit/models.rs
+++ b/src/commit/models.rs
@@ -108,21 +108,22 @@ impl Commit {
None => "NULL".to_string(),
};
raw_query += &format!(
- "('{}', {}, '{}', '{}', '{}', '{}', '{}', '{}', '{}'),",
+ "('{}', {}, E'{}', '{}', '{}', E'{}', '{}', E'{}', '{}'),",
commit.hash,
tree,
- commit.text,
+ commit.text.replace("'", "\\'"),
commit.date,
commit.author_email,
- commit.author_name,
+ commit.author_name.replace("'", "\\'"),
commit.committer_email,
- commit.committer_name,
+ commit.committer_name.replace("'", "\\'"),
commit.repository_url
)[..]
}
// Remove the last `,`
let _ = raw_query.pop();
+ raw_query += " RETURNING *";
// TODO: write query with &commits and parameter. Need to implement
// ToSql trait for `Commit` model