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

Function main

tests/tools/bound.cpp:53–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53int main(int argc, char *argv[])
54{
55 cdb2_hndl_tp *db1, *db2;
56 if(argc < 3) {
57 fprintf(stderr, "not enough parameters\n");
58 return 1;
59 }
60 cdb2_set_comdb2db_config(argv[1]);
61 cdb2_open(&db1, argv[2], "default", 0);
62 cdb2_open(&db2, argv[2], "default", 0);
63
64 string sp("exec procedure bound(");
65 string sql("select ");
66 vector<int> types;
67
68 int i = INT_MAX;
69 cdb2_bind_param(db1, "i", CDB2_INTEGER, &i, sizeof(i));
70 cdb2_bind_param(db2, "i", CDB2_INTEGER, &i, sizeof(i));
71
72 sp += quote + "@i" + quote;
73 sql += "@i";
74 types.push_back(CDB2_CSTRING);
75
76 unsigned u = UINT_MAX;
77 cdb2_bind_param(db1, "u", CDB2_INTEGER, &u, sizeof(u));
78 cdb2_bind_param(db2, "u", CDB2_INTEGER, &u, sizeof(u));
79 add_param(sp, sql, types, "u");
80
81 long long ll = LLONG_MAX;
82 cdb2_bind_param(db1, "ll", CDB2_INTEGER, &ll, sizeof(ll));
83 cdb2_bind_param(db2, "ll", CDB2_INTEGER, &ll, sizeof(ll));
84 add_param(sp, sql, types, "ll");
85
86 unsigned long long ull = ULLONG_MAX;
87 cdb2_bind_param(db1, "ull", CDB2_INTEGER, &ull, sizeof(ull));
88 cdb2_bind_param(db2, "ull", CDB2_INTEGER, &ull, sizeof(ull));
89 add_param(sp, sql, types, "ull");
90
91 short s = SHRT_MAX;
92 cdb2_bind_param(db1, "s", CDB2_INTEGER, &s, sizeof(s));
93 cdb2_bind_param(db2, "s", CDB2_INTEGER, &s, sizeof(s));
94 add_param(sp, sql, types, "s");
95
96 unsigned short us = USHRT_MAX;
97 cdb2_bind_param(db1, "us", CDB2_INTEGER, &us, sizeof(us));
98 cdb2_bind_param(db2, "us", CDB2_INTEGER, &us, sizeof(us));
99 add_param(sp, sql, types, "us");
100
101 float f = 3.14159;
102 cdb2_bind_param(db1, "f", CDB2_REAL, &f, sizeof(f));
103 cdb2_bind_param(db2, "f", CDB2_REAL, &f, sizeof(f));
104 add_param(sp, sql, types, "f");
105
106 double d = 3.14159;
107 cdb2_bind_param(db1, "d", CDB2_REAL, &d, sizeof(d));
108 cdb2_bind_param(db2, "d", CDB2_REAL, &d, sizeof(d));
109 add_param(sp, sql, types, "d");
110

Callers

nothing calls this directly

Calls 6

cdb2_set_comdb2db_configFunction · 0.85
cdb2_openFunction · 0.85
cdb2_bind_paramFunction · 0.85
cdb2_closeFunction · 0.85
add_paramFunction · 0.70
runtagFunction · 0.70

Tested by

no test coverage detected