fix small error in README; update deprecated method call

This commit is contained in:
Marcus Klaas 2014-12-03 17:14:49 +01:00
parent 659a57cf66
commit bbfedbb82e
2 changed files with 4 additions and 5 deletions

View File

@ -29,7 +29,7 @@ fn main() {
name TEXT NOT NULL,
time_created TEXT NOT NULL,
data BLOB
)", []).unwrap();
)", &[]).unwrap();
let me = Person {
id: 0,
name: "Steven".to_string(),
@ -41,7 +41,7 @@ fn main() {
&[&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),
@ -71,7 +71,7 @@ will panic if you do so. A specific example that will panic:
```rust
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 valid now...

View File

@ -57,7 +57,6 @@ extern crate time;
use libc::{c_int, c_double};
use std::c_str::{CString};
use std::mem;
use std::vec;
use super::ffi;
use super::{SqliteResult, SqliteError};
@ -186,7 +185,7 @@ impl FromSql for Vec<u8> {
assert!(len >= 0); let len = len as uint;
Ok(vec::raw::from_buf(mem::transmute(c_blob), len))
Ok(Vec::from_raw_buf(mem::transmute(c_blob), len))
}
}