-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Setup
SQl, table and data.
DROP TABLE IF EXISTS tasks;
CREATE TABLE tasks (
uuid TEXT NOT NULL PRIMARY KEY,
parent_task TEXT,
name TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 0,
description TEXT,
CONSTRAINT fk_parent,
FOREIGN KEY(parent_task)
REFERENCES tasks(uuid)
)
INSERT INTO tasks (uuid, parent_task, name, status, description)
VALUES ('03eec7f5-3163-496b-8ab3-8cf97e7860a0', NULL, 'A_root', 'Pending', 'a root');
table! {
tasks (uuid) {
uuid -> Text,
parent_task -> Nullable<Text>,
name -> Text,
status -> Text,
description -> Nullable<Text>,
}
}
Versions
- Rust:
$rustc --version
rustc 1.50.0 (cb75ad5db 2021-02-10)
- Diesel:
diesel = { version = "1.4.5", features = ["sqlite", "uuidv07", "uuid"] }
- Database:
$sqlite3 --version nix-shell
3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f
- Operating System
$nixos-version --json nix-shell
{"nixosVersion":"21.03.20210209.29a15e2","nixpkgsRevision":"29a15e2c1f5ad64c235d78ba5e29a56fe520ad45"}
I want to use the LIKE clause with the function sql_query
.
let req = sql_query("SELECT *, 0 as depth FROM tasks WHERE uuid LIKE ?;")
.bind::<Text, _>("43eec7f5%")
.get_results(self.connection.as_ref().unwrap())
.expect("res");;
The code above generates the error:
thread 'main' panicked at 'res: DeserializationError("Columnuuidwas not present in query")', src/store.rs:135:14