You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not able to execute JSON object insert . Create table is working though
Here is my code
let createtableddl = format!("CREATE TABLE {} (id INTEGER PRIMARY KEY, data JSON)",tabel_name);
println!("json_query parsed.len() {:?} ", parsed.len());
let mut conn = Connection::open_in_memory()?;
match conn.execute(&createtableddl,(),).unwrap();
let insertddl_columns = r#"INSERT INTO users (id, data) VALUES (1, json_encode({"name": "Alice","age": 25,"email": "alice@example.com"}));"#;
conn.execute(&insertddl_columns,[]).unwrap();
I am not able to execute JSON object insert . Create table is working though
Here is my code
let createtableddl = format!("CREATE TABLE {} (id INTEGER PRIMARY KEY, data JSON)",tabel_name);
println!("json_query parsed.len() {:?} ", parsed.len());
let mut conn = Connection::open_in_memory()?;
match conn.execute(&createtableddl,(),).unwrap();
let insertddl_columns = r#"INSERT INTO users (id, data) VALUES (1, json_encode({"name": "Alice","age": 25,"email": "alice@example.com"}));"#;
conn.execute(&insertddl_columns,[]).unwrap();
Here the error
SqlInputError { error: Error { code: Unknown, extended_code: 1 }, msg: "unrecognized token: "{"", sql: "INSERT INTO users (id, data) VALUES (1, json_encode({"name": "Alice","age": 25,"email": "alice@example.com"}));", offset: 52 }
The text was updated successfully, but these errors were encountered: