MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / create_tbls

Function create_tbls

tests/tools/inscntdel.cpp:73–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71} thr_info_t;
72
73void create_tbls(int N)
74{
75 cdb2_hndl_tp *h;
76 int rc = cdb2_open(&h, dbname, "default", 0);
77 if (rc != 0)
78 rc = cdb2_open(&h, dbname, "local", 0);
79 if (rc != 0) {
80 fprintf(stderr, "Error: cdb2_open failed: %d\n", rc);
81 exit(1);
82 }
83 cdb2_set_max_retries(999999);
84
85 for(int i = 0 ; i < N; i++) {
86 usleep(500);
87 {
88 std::ostringstream ss;
89 ss << "drop table if exists tt" << i;
90 std::string s = ss.str();
91 runsql(h, s);
92 }
93 usleep(500);
94 {
95 std::ostringstream ss;
96 ss << "create table tt" << i << "(i int )";
97 std::string s = ss.str();
98 runsql(h, s);
99 }
100 }
101 cdb2_close(h);
102}
103
104void *thr(void *arg)
105{

Callers

nothing calls this directly

Calls 5

cdb2_openFunction · 0.85
exitFunction · 0.85
cdb2_set_max_retriesFunction · 0.85
cdb2_closeFunction · 0.85
runsqlFunction · 0.70

Tested by

no test coverage detected