| 21 | acl::atomic_long& count_; |
| 22 | |
| 23 | void* run(void) { |
| 24 | acl::db_sqlite db(dbpath_, "gbk"); |
| 25 | |
| 26 | if (db.open() == false) { |
| 27 | printf("open %s error\r\n", dbpath_.c_str()); |
| 28 | return NULL; |
| 29 | } |
| 30 | |
| 31 | if (tbl_create(db, "tbl_test") == false) { |
| 32 | return NULL; |
| 33 | } |
| 34 | |
| 35 | int ret; |
| 36 | if (action_ == "add") { |
| 37 | ret = dbadd(db, max_); |
| 38 | } else if (action_ == "get") { |
| 39 | ret = dbget(db, max_); |
| 40 | } else if (action_ == "update") { |
| 41 | ret = dbupdate(db, max_); |
| 42 | } else if (action_ == "del") { |
| 43 | ret = dbdel(db, max_); |
| 44 | } else { |
| 45 | printf("unknown action: %s\r\n", action_.c_str()); |
| 46 | return NULL; |
| 47 | } |
| 48 | printf("db-%s: %d\r\n", action_.c_str(), ret); |
| 49 | if (ret > 0) { |
| 50 | count_ += ret; |
| 51 | } |
| 52 | return NULL; |
| 53 | } |
| 54 | |
| 55 | int dbadd(acl::db_handle& db, int max) { |
| 56 | acl::string sql; |
nothing calls this directly
no test coverage detected