mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Remove some usages of params! / NO_PARAMS
This commit is contained in:
parent
6fae5d6641
commit
32ee895b63
@ -31,7 +31,7 @@ fn main() -> Result<()> {
|
|||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
data BLOB
|
data BLOB
|
||||||
)",
|
)",
|
||||||
params![],
|
[],
|
||||||
)?;
|
)?;
|
||||||
let me = Person {
|
let me = Person {
|
||||||
id: 0,
|
id: 0,
|
||||||
@ -44,7 +44,7 @@ fn main() -> Result<()> {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
|
let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
|
||||||
let person_iter = stmt.query_map(params![], |row| {
|
let person_iter = stmt.query_map([], |row| {
|
||||||
Ok(Person {
|
Ok(Person {
|
||||||
id: row.get(0)?,
|
id: row.get(0)?,
|
||||||
name: row.get(1)?,
|
name: row.get(1)?,
|
||||||
|
11
src/lib.rs
11
src/lib.rs
@ -20,7 +20,7 @@
|
|||||||
//! name TEXT NOT NULL,
|
//! name TEXT NOT NULL,
|
||||||
//! data BLOB
|
//! data BLOB
|
||||||
//! )",
|
//! )",
|
||||||
//! params![],
|
//! [],
|
||||||
//! )?;
|
//! )?;
|
||||||
//! let me = Person {
|
//! let me = Person {
|
||||||
//! id: 0,
|
//! id: 0,
|
||||||
@ -33,7 +33,7 @@
|
|||||||
//! )?;
|
//! )?;
|
||||||
//!
|
//!
|
||||||
//! let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
|
//! let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
|
||||||
//! let person_iter = stmt.query_map(params![], |row| {
|
//! let person_iter = stmt.query_map([], |row| {
|
||||||
//! Ok(Person {
|
//! Ok(Person {
|
||||||
//! id: row.get(0)?,
|
//! id: row.get(0)?,
|
||||||
//! name: row.get(1)?,
|
//! name: row.get(1)?,
|
||||||
@ -455,8 +455,7 @@ impl Connection {
|
|||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
/// # use rusqlite::{Connection, Result};
|
/// # use rusqlite::{Connection, Result};
|
||||||
/// fn create_tables(conn: &Connection) -> Result<()> {
|
/// fn create_tables(conn: &Connection) -> Result<()> {
|
||||||
/// conn.execute_batch(
|
/// conn.execute_batch("BEGIN;
|
||||||
/// "BEGIN;
|
|
||||||
/// CREATE TABLE foo(x INTEGER);
|
/// CREATE TABLE foo(x INTEGER);
|
||||||
/// CREATE TABLE bar(y TEXT);
|
/// CREATE TABLE bar(y TEXT);
|
||||||
/// COMMIT;",
|
/// COMMIT;",
|
||||||
@ -859,7 +858,7 @@ impl fmt::Debug for Connection {
|
|||||||
|
|
||||||
/// Batch iterator
|
/// Batch iterator
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use rusqlite::{Batch, Connection, Result, NO_PARAMS};
|
/// use rusqlite::{Batch, Connection, Result};
|
||||||
///
|
///
|
||||||
/// fn main() -> Result<()> {
|
/// fn main() -> Result<()> {
|
||||||
/// let conn = Connection::open_in_memory()?;
|
/// let conn = Connection::open_in_memory()?;
|
||||||
@ -869,7 +868,7 @@ impl fmt::Debug for Connection {
|
|||||||
/// ";
|
/// ";
|
||||||
/// let mut batch = Batch::new(&conn, sql);
|
/// let mut batch = Batch::new(&conn, sql);
|
||||||
/// while let Some(mut stmt) = batch.next()? {
|
/// while let Some(mut stmt) = batch.next()? {
|
||||||
/// stmt.execute(NO_PARAMS)?;
|
/// stmt.execute([])?;
|
||||||
/// }
|
/// }
|
||||||
/// Ok(())
|
/// Ok(())
|
||||||
/// }
|
/// }
|
||||||
|
Loading…
Reference in New Issue
Block a user