| 111 | } |
| 112 | |
| 113 | static void hs_insert(const char* addr, int num, bool enable_cache) |
| 114 | { |
| 115 | const char* dbn = "test", *tbl = "user", *idx = "PRIMARY"; |
| 116 | const char* flds = "user_id,user_name,user_email"; |
| 117 | const char* bufs[3]; |
| 118 | char buf1[256], buf2[256], buf3[256]; |
| 119 | acl::hsclient client(addr, enable_cache); |
| 120 | |
| 121 | if (client.open_tbl(dbn, tbl, idx, flds) == false) |
| 122 | { |
| 123 | printf("connect %s error\n", addr); |
| 124 | return; |
| 125 | } |
| 126 | |
| 127 | for (int i = 0; i < num; i++) |
| 128 | { |
| 129 | snprintf(buf1, sizeof(buf1), "%d", i); |
| 130 | snprintf(buf2, sizeof(buf2), "zsxxsz%d", i); |
| 131 | snprintf(buf3, sizeof(buf3), "zsxxsz%d@test.com", i); |
| 132 | bufs[0] = buf1; |
| 133 | bufs[1] = buf2; |
| 134 | bufs[2] = buf3; |
| 135 | if (client.add(bufs, 3) == false) |
| 136 | { |
| 137 | printf(">>insert error: %d, %s\n", client.get_error(), |
| 138 | client.get_last_serror()); |
| 139 | break; |
| 140 | } |
| 141 | if (i < 10) |
| 142 | printf(">>insert %s,%s,%s ok\n", buf1, buf2, buf3); |
| 143 | if (i % 10000 == 0) |
| 144 | { |
| 145 | snprintf(buf1, sizeof(buf1), "insert num: %d\n", i); |
| 146 | ACL_METER_TIME(buf1); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | static void hs_dump(const std::vector<acl::hsrow*>& rows) |
| 152 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…