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

Function hs_update

lib_acl_cpp/samples/hsclient/main.cpp:253–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253static void hs_update(const char* addr, int num, bool enable_cache)
254{
255 const char* dbn = "test", *tbl = "user", *idx = "PRIMARY";
256 const char* flds = "user_name,user_email";
257 const char* bufs[2], *bufs_to[2];
258 char buf[256], buf_to1[256], buf_to2[256];
259 acl::hsclient client(addr, enable_cache);
260
261 if (client.open_tbl(dbn, tbl, idx, flds) == false)
262 {
263 printf("connect %s error: %s(%d)\n",
264 addr, client.get_last_serror(), client.get_error());
265 return;
266 }
267
268 printf(">>dbn: %s, tbl: %s, idx: %s, flds: %s\n", dbn, tbl, idx, flds);
269
270 for (int i = 0; i < num; i++)
271 {
272 snprintf(buf, sizeof(buf), "%d", i);
273 bufs[0] = buf;
274
275 snprintf(buf_to1, sizeof(buf_to1), "zsxxsz_%d", i);
276 snprintf(buf_to2, sizeof(buf_to2), "zsxxsz_%d@test.com", i);
277 bufs_to[0] = buf_to1;
278 bufs_to[1] = buf_to2;
279
280 if (client.mod(bufs, 1, bufs_to, 2) == false)
281 {
282 printf("update error: %s(%d)\n",
283 client.get_last_serror(), client.get_error());
284 break;
285 }
286
287 if (i > 0 && i % 10000 == 0)
288 {
289 snprintf(buf, sizeof(buf), "update, num: %d\n", i);
290 ACL_METER_TIME(buf);
291 }
292 if (i > 100)
293 continue;
294 printf(">> update num: %d ok\n", i);
295 }
296}
297
298static void hspool_find(const char* addr, int num, bool enable_cache)
299{

Callers

nothing calls this directly

Calls 4

open_tblMethod · 0.80
get_last_serrorMethod · 0.80
modMethod · 0.80
get_errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…