Fix the reading of string data

This commit is contained in:
Ivan Ukhov 2015-08-03 16:50:21 -04:00
parent a6de11a000
commit 26626fdeeb
2 changed files with 4 additions and 3 deletions

View File

@ -199,7 +199,7 @@ impl Readable for Value {
Type::Binary => Value::Binary(try!(Readable::read(statement, i))),
Type::Float => Value::Float(try!(Readable::read(statement, i))),
Type::Integer => Value::Integer(try!(Readable::read(statement, i))),
Type::String => Value::Binary(try!(Readable::read(statement, i))),
Type::String => Value::String(try!(Readable::read(statement, i))),
Type::Null => Value::Null,
})
}

View File

@ -72,11 +72,12 @@ fn connection_set_busy_handler() {
#[test]
fn iterator() {
let connection = setup(":memory:");
let statement = "SELECT id FROM users WHERE id = ?";
let statement = "SELECT id, name FROM users WHERE id = ?";
let mut iterator = ok!(connection.prepare(statement)).into_iter().unwrap();
ok!(iterator.start(&[Value::Integer(1)]));
assert_eq!(ok!(ok!(iterator.next())), &[Value::Integer(1)]);
assert_eq!(ok!(ok!(iterator.next())), &[Value::Integer(1),
Value::String("Alice".to_string())]);
assert_eq!(ok!(iterator.next()), None);
ok!(iterator.start(&[Value::Integer(42)]));