Skip to content

Commit 5234849

Browse files
authored
issue-689 updated rusqlite to use () for no params (#708)
1 parent dfbf6b9 commit 5234849

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/database/sqlite/initialization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Use the `rusqlite` crate to open SQLite databases. See
77

88
[`Connection::open`] will create the database if it doesn't already exist.
99

10-
```rust,edition2018,no_run
10+
```rust,edition2024,no_run
1111
use rusqlite::{Connection, Result};
1212
1313
fn main() -> Result<()> {
@@ -18,15 +18,15 @@ fn main() -> Result<()> {
1818
id integer primary key,
1919
name text not null unique
2020
)",
21-
[],
21+
(),
2222
)?;
2323
conn.execute(
2424
"create table if not exists cats (
2525
id integer primary key,
2626
name text not null,
2727
color_id integer not null references cat_colors(id)
2828
)",
29-
[],
29+
(),
3030
)?;
3131
3232
Ok(())

src/database/sqlite/insert_select.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[`Connection::open`] will open the database `cats` created in the earlier recipe.
66
This recipe inserts data into `cat_colors` and `cats` tables using the [`execute`] method of `Connection`. First, the data is inserted into the `cat_colors` table. After a record for a color is inserted, [`last_insert_rowid`] method of `Connection` is used to get `id` of the last color inserted. This `id` is used while inserting data into the `cats` table. Then, the select query is prepared using the [`prepare`] method which gives a [`statement`] struct. Then, query is executed using [`query_map`] method of [`statement`].
77

8-
```rust,no_run
8+
```rust,edition2024,no_run
99
1010
use rusqlite::{params, Connection, Result};
1111
use std::collections::HashMap;
@@ -51,7 +51,14 @@ fn main() -> Result<()> {
5151
})?;
5252
5353
for cat in cats {
54-
println!("Found cat {:?}", cat);
54+
if let Ok(found_cat) = cat {
55+
println!(
56+
"Found cat {:?} {} is {}",
57+
found_cat,
58+
found_cat.name,
59+
found_cat.color,
60+
);
61+
}
5562
}
5663
5764
Ok(())

src/database/sqlite/transactions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ a unique constraint on the color name. When an attempt to insert
1212
a duplicate color is made, the transaction rolls back.
1313

1414

15-
```rust,edition2018,no_run
15+
```rust,edition2024,no_run
1616
use rusqlite::{Connection, Result};
1717
1818
fn main() -> Result<()> {

0 commit comments

Comments
 (0)