taitan_orm/database/sqlite/
executor.rs

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175


// impl SqlGenericExecutor for SqliteDatabase {
//     type DB = Sqlite;
//
//     fn get_affected_rows(query_result: &<Self::DB as sqlx::Database>::QueryResult) -> u64 {
//         query_result.rows_affected()
//     }
// }
// impl crate::SqlExecutor for SqliteDatabase {
//     executor_impl!(SqliteConnection);
// }

//
// impl crate::SqlExecutor for SqliteDatabase {
//     type Connection = SqliteConnection;
//
//     #[inline(always)]
//     async fn get_connection(&mut self) -> crate::Result<sqlx::pool::PoolConnection<Self::DB>> {
//         Ok(self.get_pool()?.acquire().await?)
//     }
//
//     async fn execute<'a>(&'a mut self, stmt: &'a str, args: <Self::DB as sqlx::Database>::Arguments<'a>) -> crate::Result<u64>
//     {
//         let mut ex = self.get_connection().await?;
//         Self::generic_execute(&mut *ex, stmt, args).await
//     }
//
//     async fn execute_plain<'a>(&'a mut self, stmt: &'a str) -> crate::Result<u64> {
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_execute_plain(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_exists<'a>(
//         &'a mut self,
//         stmt: &'a str,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<bool> {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_exists(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_exists_plain<'a, A>(&'a mut self, stmt: &'a str) -> crate::Result<bool>
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_exists_plain(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_option<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         selection: &'a SE::Selection,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<Option<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_fetch_option(&mut *ex, stmt, selection, args).await
//     }
//
//     async fn fetch_option_plain<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         selection: &'a SE::Selection,
//     ) -> crate::Result<Option<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_fetch_option_plain(&mut *ex, stmt, selection, args).await
//     }
//
//     async fn fetch_all<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         selection: &'a SE::Selection,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<Vec<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_fetch_all(&mut *ex, stmt, selection, args).await
//     }
//
//     async fn fetch_all_plain<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         selection: &'a SE::Selection,
//     ) -> crate::Result<Vec<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_fetch_all_plain(&mut *ex, stmt, selection, args).await
//     }
//
//     async fn fetch_one_full<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<SE>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_fetch_one_full(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_one_full_plain<'a, SE>(&'a mut self, stmt: &'a str) -> crate::Result<SE>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_fetch_one_full_plain(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_option_full<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<Option<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_fetch_option_full(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_option_full_plain<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//     ) -> crate::Result<Option<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_fetch_option_full_plain(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_all_full<'a, SE>(
//         &'a mut self,
//         stmt: &'a str,
//         args: <Self::DB as sqlx::Database>::Arguments<'a>,
//     ) -> crate::Result<Vec<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         Self::generic_fetch_all_full(&mut *ex, stmt, args).await
//     }
//
//     async fn fetch_all_full_plain<'a, SE>(&'a mut self, stmt: &'a str) -> crate::Result<Vec<SE>>
//     where
//         SE: taitan_orm_trait::SelectedEntity<Self::DB> + Send + Unpin,
//     {
//         let mut ex = self.get_pool()?.acquire().await?;
//         let args: std::marker::PhantomData<<Self::DB as sqlx::Database>::Arguments<'a>> =
//             std::marker::PhantomData::default();
//         Self::generic_fetch_all_full_plain(&mut *ex, stmt, args).await
//     }
// }