| 13 | static string at("@"); |
| 14 | |
| 15 | int runtag(cdb2_hndl_tp *h, string &sql, vector<int> &types) |
| 16 | { |
| 17 | int rc = |
| 18 | cdb2_run_statement_typed(h, sql.c_str(), types.size(), types.data()); |
| 19 | if (rc != 0) { |
| 20 | fprintf(stderr, "cdb2_run_statement_typed failed: %d %s\n", rc, |
| 21 | cdb2_errstr(h)); |
| 22 | return rc; |
| 23 | } |
| 24 | |
| 25 | rc = cdb2_next_record(h); |
| 26 | while (rc == CDB2_OK) { |
| 27 | int n = cdb2_numcolumns(h); |
| 28 | int i; |
| 29 | const char *c = ""; |
| 30 | for (i = 0; i < n; ++i) { |
| 31 | printf("%s%s", c, (char *)cdb2_column_value(h, i)); |
| 32 | c = ", "; |
| 33 | } |
| 34 | puts(""); |
| 35 | rc = cdb2_next_record(h); |
| 36 | } |
| 37 | |
| 38 | if (rc == CDB2_OK_DONE) |
| 39 | rc = 0; |
| 40 | else |
| 41 | fprintf(stderr, "cdb2_next_record failed: %d %s\n", rc, cdb2_errstr(h)); |
| 42 | return rc; |
| 43 | } |
| 44 | |
| 45 | void add_param(string &sp, string &sql, vector<int> &types, string name, |
| 46 | string extra1 = "", string extra2 = "") |
no test coverage detected