1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use crate::{
common::{views::ColumnView, Value},
Queryable,
};
mod column;
pub use column::*;
pub trait Bindable<Q>
where
Q: Queryable,
Self: Sized,
{
type Error;
fn init(taos: &Q) -> Result<Self, Self::Error>;
fn prepare<S: AsRef<str>>(&mut self, sql: S) -> Result<&mut Self, Self::Error>;
fn set_tbname<S: AsRef<str>>(&mut self, name: S) -> Result<&mut Self, Self::Error>;
fn set_tags(&mut self, tags: &[Value]) -> Result<&mut Self, Self::Error>;
fn set_tbname_tags<S: AsRef<str>>(
&mut self,
name: S,
tags: &[Value],
) -> Result<&mut Self, Self::Error> {
self.set_tbname(name)?.set_tags(tags)
}
fn bind(&mut self, params: &[ColumnView]) -> Result<&mut Self, Self::Error>;
fn add_batch(&mut self) -> Result<&mut Self, Self::Error>;
fn execute(&mut self) -> Result<usize, Self::Error>;
fn affected_rows(&self) -> usize;
fn result_set(&mut self) -> Result<Q::ResultSet, Self::Error> {
todo!()
}
}