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