Track changes in rust-nightly

This commit is contained in:
John Gallagher 2014-11-19 10:48:40 -05:00
parent 4667a410af
commit f2c6389601
3 changed files with 23 additions and 18 deletions

View File

@ -24,7 +24,7 @@
//! name TEXT NOT NULL,
//! time_created TEXT NOT NULL,
//! data BLOB
//! )", []).unwrap();
//! )", &[]).unwrap();
//! let me = Person {
//! id: 0,
//! name: "Steven".to_string(),
@ -36,7 +36,7 @@
//! &[&me.name, &me.time_created, &me.data]).unwrap();
//!
//! let mut stmt = conn.prepare("SELECT id, name, time_created, data FROM person").unwrap();
//! for row in stmt.query([]).unwrap().map(|row| row.unwrap()) {
//! for row in stmt.query(&[]).unwrap().map(|row| row.unwrap()) {
//! let person = Person {
//! id: row.get(0),
//! name: row.get(1),
@ -228,7 +228,7 @@ impl SqliteConnection {
/// ```rust,no_run
/// # use rusqlite::{SqliteConnection};
/// fn preferred_locale(conn: &SqliteConnection) -> String {
/// conn.query_row("SELECT value FROM preferences WHERE name='locale'", [], |row| {
/// conn.query_row("SELECT value FROM preferences WHERE name='locale'", &[], |row| {
/// row.get(0)
/// })
/// }
@ -448,7 +448,7 @@ impl<'conn> SqliteStatement<'conn> {
/// # use rusqlite::{SqliteConnection, SqliteResult};
/// fn get_names(conn: &SqliteConnection) -> SqliteResult<Vec<String>> {
/// let mut stmt = try!(conn.prepare("SELECT name FROM people"));
/// let mut rows = try!(stmt.query([]));
/// let mut rows = try!(stmt.query(&[]));
///
/// let mut names = Vec::new();
/// for result_row in rows {
@ -522,7 +522,7 @@ impl<'conn> Drop for SqliteStatement<'conn> {
/// # use rusqlite::{SqliteConnection, SqliteResult};
/// fn bad_function_will_panic(conn: &SqliteConnection) -> SqliteResult<i64> {
/// let mut stmt = try!(conn.prepare("SELECT id FROM my_table"));
/// let mut rows = try!(stmt.query([]));
/// let mut rows = try!(stmt.query(&[]));
///
/// let row0 = try!(rows.next().unwrap());
/// // row 0 is value now...
@ -600,7 +600,7 @@ impl<'stmt> SqliteRow<'stmt> {
/// # use rusqlite::{SqliteConnection, SqliteResult};
/// fn bad_function_will_panic(conn: &SqliteConnection) -> SqliteResult<i64> {
/// let mut stmt = try!(conn.prepare("SELECT id FROM my_table"));
/// let mut rows = try!(stmt.query([]));
/// let mut rows = try!(stmt.query(&[]));
///
/// let row0 = try!(rows.next().unwrap());
/// // row 0 is value now...
@ -697,7 +697,7 @@ mod test {
assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", &[&1i32]).unwrap(), 1);
assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", &[&2i32]).unwrap(), 1);
assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", [], |r| r.get(0)));
assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)));
}
#[test]
@ -762,7 +762,7 @@ mod test {
db.execute_batch("INSERT INTO foo(x) VALUES(2)").unwrap();
let mut stmt = db.prepare("SELECT x FROM foo ORDER BY x").unwrap();
let mut rows = stmt.query([]).unwrap();
let mut rows = stmt.query(&[]).unwrap();
let first = rows.next().unwrap().unwrap();
let second = rows.next().unwrap().unwrap();
@ -782,7 +782,7 @@ mod test {
let mut stmt = db.prepare("INSERT INTO foo DEFAULT VALUES").unwrap();
for _ in range(0i, 9) {
stmt.execute([]).unwrap();
stmt.execute(&[]).unwrap();
}
assert_eq!(db.last_insert_rowid(), 10);
}

View File

@ -1,5 +1,10 @@
use {SqliteResult, SqliteConnection};
pub use SqliteTransactionBehavior::{
SqliteTransactionDeferred,
SqliteTransactionImmediate,
SqliteTransactionExclusive};
/// Options for transaction behavior. See [BEGIN
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
pub enum SqliteTransactionBehavior {
@ -177,7 +182,7 @@ mod test {
}
{
let _tx = db.transaction().unwrap();
assert_eq!(2i32, db.query_row("SELECT SUM(x) FROM foo", [], |r| r.get(0)));
assert_eq!(2i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)));
}
}
@ -196,7 +201,7 @@ mod test {
}
{
let _tx = db.transaction().unwrap();
assert_eq!(2i32, db.query_row("SELECT SUM(x) FROM foo", [], |r| r.get(0)));
assert_eq!(2i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)));
}
}
@ -224,7 +229,7 @@ mod test {
}
}
}
assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", [], |r| r.get(0)));
assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)));
}
#[bench]
@ -235,7 +240,7 @@ mod test {
bencher.iter(|| {
for _ in range(0i32, 1000) {
stmt.execute([]).unwrap();
stmt.execute(&[]).unwrap();
}
})
}
@ -250,7 +255,7 @@ mod test {
let mut tx = db.transaction().unwrap();
tx.set_commit();
for _ in range(0i32, 1000) {
stmt.execute([]).unwrap();
stmt.execute(&[]).unwrap();
}
})
}

View File

@ -232,7 +232,7 @@ mod test {
let v1234 = vec![1u8,2,3,4];
db.execute("INSERT INTO foo(b) VALUES (?)", &[&v1234]).unwrap();
let v: Vec<u8> = db.query_row("SELECT b FROM foo", [], |r| r.get(0));
let v: Vec<u8> = db.query_row("SELECT b FROM foo", &[], |r| r.get(0));
assert_eq!(v, v1234);
}
@ -243,7 +243,7 @@ mod test {
let s = "hello, world!";
db.execute("INSERT INTO foo(t) VALUES (?)", &[&s.to_string()]).unwrap();
let from: String = db.query_row("SELECT t FROM foo", [], |r| r.get(0));
let from: String = db.query_row("SELECT t FROM foo", &[], |r| r.get(0));
assert_eq!(from.as_slice(), s);
}
@ -254,7 +254,7 @@ mod test {
let ts = time::Timespec{sec: 10_000, nsec: 0 };
db.execute("INSERT INTO foo(t) VALUES (?)", &[&ts]).unwrap();
let from: time::Timespec = db.query_row("SELECT t FROM foo", [], |r| r.get(0));
let from: time::Timespec = db.query_row("SELECT t FROM foo", &[], |r| r.get(0));
assert_eq!(from, ts);
}
@ -269,7 +269,7 @@ mod test {
db.execute("INSERT INTO foo(b) VALUES (?)", &[&b]).unwrap();
let mut stmt = db.prepare("SELECT t, b FROM foo ORDER BY ROWID ASC").unwrap();
let mut rows = stmt.query([]).unwrap();
let mut rows = stmt.query(&[]).unwrap();
let row1 = rows.next().unwrap().unwrap();
let s1: Option<String> = row1.get(0);