Lines Matching refs:tx
18 pub fn create_or_get_version(tx: &Transaction, current_version: u32) -> Result<u32> { in create_or_get_version()
19 tx.execute( in create_or_get_version()
27 let version = tx in create_or_get_version()
43 let version = if tx in create_or_get_version()
59 tx.execute("INSERT INTO persistent.version (id, version) VALUES(0, ?);", params![version]) in create_or_get_version()
66 pub fn update_version(tx: &Transaction, new_version: u32) -> Result<()> { in update_version()
67 let updated = tx in update_version()
77 pub fn upgrade_database<F>(tx: &Transaction, current_version: u32, upgraders: &[F]) -> Result<()> in upgrade_database()
84 let mut db_version = create_or_get_version(tx, current_version) in upgrade_database()
87 db_version = upgraders[db_version as usize](tx).with_context(|| { in upgrade_database()
91 update_version(tx, db_version).context("In upgrade_database.") in upgrade_database()
106 move |tx: &Transaction| { in upgrade_database_test()
107 tx.execute( in upgrade_database_test()
145 let tx = in upgrade_database_test() localVariable
147 create_or_get_version(&tx, from).unwrap(); in upgrade_database_test()
148 tx.commit().unwrap(); in upgrade_database_test()
151 let tx = in upgrade_database_test() localVariable
153 upgrade_database(&tx, to, &upgraders).unwrap(); in upgrade_database_test()
154 tx.commit().unwrap(); in upgrade_database_test()
193 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_new_database() localVariable
194 let version = create_or_get_version(&tx, 3).unwrap(); in create_or_get_version_new_database()
195 tx.commit().unwrap(); in create_or_get_version_new_database()
230 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_new_database() localVariable
231 let version = create_or_get_version(&tx, 5).unwrap(); in create_or_get_version_new_database()
232 tx.commit().unwrap(); in create_or_get_version_new_database()
245 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_new_database() localVariable
246 update_version(&tx, 5).unwrap(); in create_or_get_version_new_database()
247 tx.commit().unwrap(); in create_or_get_version_new_database()
252 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_new_database() localVariable
253 let version = create_or_get_version(&tx, 7).unwrap(); in create_or_get_version_new_database()
254 tx.commit().unwrap(); in create_or_get_version_new_database()
296 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_legacy_database() localVariable
297 let version = create_or_get_version(&tx, 3).unwrap(); in create_or_get_version_legacy_database()
298 tx.commit().unwrap(); in create_or_get_version_legacy_database()
334 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_legacy_database() localVariable
335 let version = create_or_get_version(&tx, 5).unwrap(); in create_or_get_version_legacy_database()
336 tx.commit().unwrap(); in create_or_get_version_legacy_database()
349 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_legacy_database() localVariable
350 update_version(&tx, 5).unwrap(); in create_or_get_version_legacy_database()
351 tx.commit().unwrap(); in create_or_get_version_legacy_database()
356 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate).unwrap(); in create_or_get_version_legacy_database() localVariable
357 let version = create_or_get_version(&tx, 7).unwrap(); in create_or_get_version_legacy_database()
358 tx.commit().unwrap(); in create_or_get_version_legacy_database()