Breathe life back into this project. #1
3 changed files with 4 additions and 4 deletions
|
@ -76,7 +76,7 @@ impl SyncMetadata {
|
|||
pub fn set_remote_head(tx: &rusqlite::Transaction, uuid: &Uuid) -> Result<()> {
|
||||
let uuid_bytes = uuid.as_bytes().to_vec();
|
||||
let updated = tx.execute("UPDATE tolstoy_metadata SET value = ? WHERE key = ?",
|
||||
&[&uuid_bytes, &schema::REMOTE_HEAD_KEY])?;
|
||||
rusqlite::params![&uuid_bytes, &schema::REMOTE_HEAD_KEY])?;
|
||||
if updated != 1 {
|
||||
bail!(TolstoyError::DuplicateMetadata(schema::REMOTE_HEAD_KEY.into()));
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ pub fn ensure_current_version(tx: &mut rusqlite::Transaction) -> Result<()> {
|
|||
|
||||
// Initial partition information is what we'd see at bootstrap, and is used during first sync.
|
||||
for (name, start, end, index, allow_excision) in BOOTSTRAP_PARTITIONS.iter() {
|
||||
tx.execute("INSERT OR IGNORE INTO tolstoy_parts VALUES (?, ?, ?, ?, ?)", &[&name.to_string(), start, end, index, allow_excision])?;
|
||||
tx.execute("INSERT OR IGNORE INTO tolstoy_parts VALUES (?, ?, ?, ?, ?)", rusqlite::params![&name.to_string(), start, end, index, allow_excision])?;
|
||||
}
|
||||
|
||||
tx.execute("INSERT OR IGNORE INTO tolstoy_metadata (key, value) VALUES (?, zeroblob(16))", &[&REMOTE_HEAD_KEY])?;
|
||||
|
|
|
@ -37,7 +37,7 @@ impl TxMapper {
|
|||
)?;
|
||||
for mapping in mappings.iter() {
|
||||
let uuid_bytes = mapping.remote.as_bytes().to_vec();
|
||||
stmt.execute(&[&mapping.local, &uuid_bytes])?;
|
||||
stmt.execute(rusqlite::params![&mapping.local, &uuid_bytes])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ impl TxMapper {
|
|||
None => {
|
||||
let uuid = Uuid::new_v4();
|
||||
let uuid_bytes = uuid.as_bytes().to_vec();
|
||||
db_tx.execute("INSERT INTO tolstoy_tu (tx, uuid) VALUES (?, ?)", &[&tx, &uuid_bytes])?;
|
||||
db_tx.execute("INSERT INTO tolstoy_tu (tx, uuid) VALUES (?, ?)", rusqlite::params![&tx, &uuid_bytes])?;
|
||||
return Ok(uuid);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue