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

Function hs_insert

lib_acl_cpp/samples/hsclient/main.cpp:113–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113static 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
151static void hs_dump(const std::vector<acl::hsrow*>& rows)
152{

Callers

nothing calls this directly

Calls 4

open_tblMethod · 0.80
get_last_serrorMethod · 0.80
addMethod · 0.45
get_errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…