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