Introduce NO_PARAMS constant

As suggested here:
https://users.rust-lang.org/t/sql-parameter-values/20469/2
This commit is contained in:
gwenn
2018-09-16 11:10:19 +02:00
parent c4ae541eac
commit e7e03c3443
15 changed files with 152 additions and 208 deletions

View File

@@ -32,8 +32,7 @@ impl FromSql for time::Timespec {
#[cfg(test)]
mod test {
use super::time;
use types::ToSql;
use Connection;
use {Connection, NO_PARAMS};
fn checked_memory_handle() -> Connection {
let db = Connection::open_in_memory().unwrap();
@@ -59,10 +58,10 @@ mod test {
db.execute("INSERT INTO foo(t) VALUES (?)", &[&ts]).unwrap();
let from: time::Timespec = db
.query_row("SELECT t FROM foo", &[] as &[&ToSql], |r| r.get(0))
.query_row("SELECT t FROM foo", NO_PARAMS, |r| r.get(0))
.unwrap();
db.execute("DELETE FROM foo", &[] as &[&ToSql]).unwrap();
db.execute("DELETE FROM foo", NO_PARAMS).unwrap();
assert_eq!(from, ts);
}