Merge remote-tracking branch 'jgallagher/master' into vtab

This commit is contained in:
gwenn
2016-05-20 18:31:30 +02:00
16 changed files with 71 additions and 62 deletions

View File

@@ -80,7 +80,8 @@ use error::{error_from_sqlite_code, error_from_handle};
use raw_statement::RawStatement;
use cache::StatementCache;
pub use transaction::{SqliteTransaction, Transaction, TransactionBehavior};
pub use transaction::{SqliteTransaction, SqliteTransactionBehavior, DropBehavior, Savepoint,
Transaction, TransactionBehavior};
pub use error::{SqliteError, Error};
pub use cache::CachedStatement;
@@ -320,7 +321,9 @@ impl Connection {
/// ```rust,no_run
/// # use rusqlite::{Result,Connection};
/// fn preferred_locale(conn: &Connection) -> Result<String> {
/// conn.query_row_and_then("SELECT value FROM preferences WHERE name='locale'", &[], |row| {
/// conn.query_row_and_then("SELECT value FROM preferences WHERE name='locale'",
/// &[],
/// |row| {
/// row.get_checked(0)
/// })
/// }
@@ -710,9 +713,12 @@ impl<'conn> Statement<'conn> {
}
/// Returns the column index in the result set for a given column name.
/// If there is no AS clause then the name of the column is unspecified and may change from one release of SQLite to the next.
///
/// If there is no AS clause then the name of the column is unspecified and may change from one
/// release of SQLite to the next.
///
/// # Failure
///
/// Will return an `Error::InvalidColumnName` when there is no column with the specified `name`.
pub fn column_index(&self, name: &str) -> Result<i32> {
let bytes = name.as_bytes();
@@ -966,9 +972,7 @@ pub struct Rows<'stmt> {
impl<'stmt> Rows<'stmt> {
fn new(stmt: &'stmt Statement<'stmt>) -> Rows<'stmt> {
Rows {
stmt: Some(stmt),
}
Rows { stmt: Some(stmt) }
}
fn get_expected_row<'a>(&'a mut self) -> Result<Row<'a, 'stmt>> {
@@ -1372,19 +1376,6 @@ mod test {
}
}
#[test]
#[should_panic]
fn test_rows_dropped() {
let db = checked_memory_handle();
db.execute_batch("CREATE TABLE foo(x INTEGER)").unwrap();
db.execute_batch("INSERT INTO foo(x) VALUES(1)").unwrap();
let mut stmt = db.prepare("SELECT x FROM foo").unwrap();
let row = stmt.query(&[]).unwrap().next().unwrap().unwrap();
assert_eq!(1i32, row.get(0));
}
mod query_and_then_tests {
extern crate libsqlite3_sys as ffi;
use super::*;