Skip to content

Commit b8c37eb

Browse files
committed
Fix overflow
1 parent 4ce9766 commit b8c37eb

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

src/data/recipe/from/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
mod method;
22
pub use method::*;
33

4-
use {super::Recipe, crate::Value};
4+
use {
5+
super::{Ingredient, Recipe},
6+
crate::Value,
7+
};
58

69
impl<T: Into<Value>> From<T> for Recipe {
710
fn from(value: T) -> Recipe {
8-
let value: Value = value.into();
9-
value.into()
11+
Recipe::Ingredient(Ingredient::Value(value.into()))
1012
}
1113
}

src/databases/csv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod mutable;
55
mod record;
66
mod utils;
77

8-
pub use {discern::*, record::*};
8+
pub use record::*;
99

1010
use {
1111
crate::{data::Schema, DBFull, Database, Result, WIPError},

src/glue/insert.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ pub trait ParameterValue {
1313

1414
#[macro_export]
1515
macro_rules! INSERT {
16-
{$glue:expr, INTO $database:ident.$table:ident ($($column:ident),*) VALUES $(($($value:expr),*)),*} => {
17-
$glue.insert(Some(stringify!($database)), stringify!($table), &[$(stringify!($column)),*], vec![$(vec![$($value.into()),*]),*]);
16+
{$glue:expr, INTO $database:ident.$table:ident ($($column:ident),+) VALUES $(($($value:expr),+)),+} => {
17+
$glue.insert(Some(stringify!($database)), stringify!($table), &[$(stringify!($column)),+], vec![$(vec![$($value.into()),+]),+])
1818
};
19-
{$glue:expr, INTO $table:ident ($($column:ident),*) VALUES $(($($value:expr),*)),*} => {
20-
$glue.insert(None, stringify!($table), &[$(stringify!($column)),*], vec![$(vec![$($value.into()),*]),*]);
19+
{$glue:expr, INTO $table:ident ($($column:ident),+) VALUES $(($($value:expr),+)),+} => {
20+
$glue.insert(None, stringify!($table), &[$(stringify!($column)),+], vec![$(vec![$($value.into()),+]),+])
2121
};
2222
}
2323

@@ -49,3 +49,14 @@ impl Glue {
4949
))
5050
}
5151
}
52+
53+
#[test]
54+
fn test() {
55+
use crate::{Connection, Glue};
56+
let db = Connection::Memory.try_into().unwrap();
57+
let mut glue = Glue::new(String::from("test"), db);
58+
glue.execute("CREATE TABLE basic (a INT)").unwrap();
59+
glue.insert(None, "basic", &["a"], vec![vec![2.into()]])
60+
.unwrap();
61+
//INSERT! {glue, INTO basic (a) VALUES (2)}.unwrap();
62+
}

0 commit comments

Comments
 (0)