| 243 | |
| 244 | protected: |
| 245 | void* run() |
| 246 | { |
| 247 | int n = 0; |
| 248 | |
| 249 | for (int i = 0; i < max_; i++) |
| 250 | { |
| 251 | acl::db_handle* db = pool_.peek_open(); |
| 252 | if (db == NULL) |
| 253 | { |
| 254 | printf("peek db connection error\r\n"); |
| 255 | break; |
| 256 | } |
| 257 | |
| 258 | bool ret = tbl_insert(*db, i); |
| 259 | if (ret) |
| 260 | { |
| 261 | printf(">>insert ok: i=%d, affected: %d\r", |
| 262 | i, db->affect_count()); |
| 263 | n++; |
| 264 | } |
| 265 | else |
| 266 | printf(">>insert error: i = %d\r\n", i); |
| 267 | |
| 268 | pool_.put(db); |
| 269 | } |
| 270 | printf("\r\n"); |
| 271 | printf(">>insert total: %d\r\n", n); |
| 272 | |
| 273 | n = 0; |
| 274 | // ������ѯ���� |
| 275 | for (int i = 0; i < max_; i++) |
| 276 | { |
| 277 | acl::db_handle* db = pool_.peek_open(); |
| 278 | if (db == NULL) |
| 279 | { |
| 280 | printf("peek db connection error\r\n"); |
| 281 | break; |
| 282 | } |
| 283 | |
| 284 | int ret = tbl_select(*db, i); |
| 285 | if (ret >= 0) |
| 286 | { |
| 287 | n += ret; |
| 288 | printf(">>select ok: i=%d, ret=%d\r", i, ret); |
| 289 | } |
| 290 | else |
| 291 | printf(">>select error: i = %d\r\n", i); |
| 292 | |
| 293 | pool_.put(db); |
| 294 | } |
| 295 | printf("\r\n"); |
| 296 | printf(">>select total: %d\r\n", n); |
| 297 | |
| 298 | // ����ɾ������ |
| 299 | for (int i = 0; i < max_; i++) |
| 300 | { |
| 301 | acl::db_handle* db = pool_.peek_open(); |
| 302 | if (db == NULL) |
nothing calls this directly
no test coverage detected