MCPcopy Create free account
hub / github.com/acl-dev/acl / run

Method run

lib_acl_cpp/samples/sqlite/sqlite.cpp:163–219  ·  view source on GitHub ↗

@override

Source from the content-addressed store, hash-verified

161protected:
162 // @override
163 void* run(void)
164 {
165 for (int i = min_; i < max_; i++)
166 {
167 lk_.lock();
168 if (tbl_insert(db_, i))
169 printf(">>insert ok: i=%d, affected: %d\r",
170 i, db_.affect_count());
171 else
172 {
173 printf(">>insert error: i = %d\r\n", i);
174 abort();
175 }
176 lk_.unlock();
177 }
178 printf("\r\n");
179 printf(">>insert total affect: %d\n", db_.affect_total_count());
180
181 int n = 0;
182 for (int i = min_; i < max_; i++)
183 {
184 lk_.lock();
185 int ret = tbl_select(db_, i);
186 lk_.unlock();
187
188 if (ret >= 0)
189 {
190 n += ret;
191 printf(">>select ok: i=%d, ret=%d\r", i, ret);
192 }
193 else
194 {
195 printf(">>select error: i = %d\r\n", i);
196 abort();
197 }
198 }
199 printf("\r\n");
200 printf(">>select total: %d\r\n", n);
201
202 for (int i = min_; i < max_; i++)
203 {
204 lk_.lock();
205 if (tbl_delete(db_, i))
206 printf(">>delete ok: %d, affected: %d\r",
207 i, (int) db_.affect_count());
208 else
209 {
210 printf(">>delete error: i = %d\r\n", i);
211 abort();
212 }
213 lk_.unlock();
214 }
215 printf("\r\n");
216 printf(">>delete total affected: %d\n", db_.affect_total_count());
217
218 return NULL;
219 }
220

Callers

nothing calls this directly

Calls 7

affect_total_countMethod · 0.80
tbl_insertFunction · 0.70
tbl_selectFunction · 0.70
tbl_deleteFunction · 0.70
lockMethod · 0.45
affect_countMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected