mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Rename some static variables
This commit is contained in:
parent
be98290bbd
commit
20fed1956e
18
src/hooks.rs
18
src/hooks.rs
@ -243,15 +243,15 @@ mod test {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
||||
lazy_static! {
|
||||
static ref called: AtomicBool = AtomicBool::new(false);
|
||||
static ref CALLED: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
db.commit_hook(Some(|| {
|
||||
called.store(true, Ordering::Relaxed);
|
||||
CALLED.store(true, Ordering::Relaxed);
|
||||
false
|
||||
}));
|
||||
db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); COMMIT;")
|
||||
.unwrap();
|
||||
assert!(called.load(Ordering::Relaxed));
|
||||
assert!(CALLED.load(Ordering::Relaxed));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -272,14 +272,14 @@ mod test {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
||||
lazy_static! {
|
||||
static ref called: AtomicBool = AtomicBool::new(false);
|
||||
static ref CALLED: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
db.rollback_hook(Some(|| {
|
||||
called.store(true, Ordering::Relaxed);
|
||||
CALLED.store(true, Ordering::Relaxed);
|
||||
}));
|
||||
db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); ROLLBACK;")
|
||||
.unwrap();
|
||||
assert!(called.load(Ordering::Relaxed));
|
||||
assert!(CALLED.load(Ordering::Relaxed));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -287,17 +287,17 @@ mod test {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
||||
lazy_static! {
|
||||
static ref called: AtomicBool = AtomicBool::new(false);
|
||||
static ref CALLED: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
db.update_hook(Some(|action, db: &str, tbl: &str, row_id| {
|
||||
assert_eq!(Action::SQLITE_INSERT, action);
|
||||
assert_eq!("main", db);
|
||||
assert_eq!("foo", tbl);
|
||||
assert_eq!(1, row_id);
|
||||
called.store(true, Ordering::Relaxed);
|
||||
CALLED.store(true, Ordering::Relaxed);
|
||||
}));
|
||||
db.execute_batch("CREATE TABLE foo (t TEXT)").unwrap();
|
||||
db.execute_batch("INSERT INTO foo VALUES ('lisa')").unwrap();
|
||||
assert!(called.load(Ordering::Relaxed));
|
||||
assert!(CALLED.load(Ordering::Relaxed));
|
||||
}
|
||||
}
|
||||
|
@ -797,19 +797,19 @@ mod test {
|
||||
.unwrap();
|
||||
|
||||
lazy_static! {
|
||||
static ref called: AtomicBool = AtomicBool::new(false);
|
||||
static ref CALLED: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
db.apply(
|
||||
&changeset,
|
||||
None::<fn(&str) -> bool>,
|
||||
|_conflict_type, _item| {
|
||||
called.store(true, Ordering::Relaxed);
|
||||
CALLED.store(true, Ordering::Relaxed);
|
||||
ConflictAction::SQLITE_CHANGESET_OMIT
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert!(!called.load(Ordering::Relaxed));
|
||||
assert!(!CALLED.load(Ordering::Relaxed));
|
||||
let check = db
|
||||
.query_row("SELECT 1 FROM foo WHERE t = ?", &["bar"], |row| {
|
||||
row.get::<_, i32>(0)
|
||||
@ -822,7 +822,7 @@ mod test {
|
||||
&changeset,
|
||||
None::<fn(&str) -> bool>,
|
||||
|conflict_type, item| {
|
||||
called.store(true, Ordering::Relaxed);
|
||||
CALLED.store(true, Ordering::Relaxed);
|
||||
assert_eq!(ConflictType::SQLITE_CHANGESET_CONFLICT, conflict_type);
|
||||
let conflict = item.conflict(0).unwrap();
|
||||
assert_eq!(Ok("bar"), conflict.as_str());
|
||||
@ -830,7 +830,7 @@ mod test {
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
assert!(called.load(Ordering::Relaxed));
|
||||
assert!(CALLED.load(Ordering::Relaxed));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user