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

Function create_sqlite_stat_sqlmaster_record

db/sqlglue.c:1753–1785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1751}
1752
1753static void create_sqlite_stat_sqlmaster_record(struct dbtable *tbl)
1754{
1755 if (tbl->sql)
1756 free(tbl->sql);
1757 for (int i = 0; i < tbl->nsqlix; i++) {
1758 free(tbl->ixsql[i]);
1759 tbl->ixsql[i] = NULL;
1760 }
1761 switch (tbl->tablename[11]) {
1762 case '1':
1763 tbl->sql = strdup("create table sqlite_stat1(tbl,idx,stat);");
1764 break;
1765 case '2':
1766 tbl->sql =
1767 strdup("create table sqlite_stat2(tbl,idx,sampleno,sample);");
1768 break;
1769 case '4':
1770 tbl->sql =
1771 strdup("create table sqlite_stat4(tbl,idx,neq,nlt,ndlt,sample);");
1772 break;
1773 default:
1774 abort();
1775 }
1776 if (tbl->ixsql) {
1777 free(tbl->ixsql);
1778 tbl->ixsql = NULL;
1779 }
1780 tbl->ixsql = calloc(sizeof(char *), tbl->nix);
1781 tbl->nsqlix = 0;
1782 tbl->ix_expr = 0;
1783 tbl->ix_partial = 0;
1784 tbl->ix_blob = 0;
1785}
1786
1787int create_datacopy_arrays()
1788{

Callers 1

create_sqlmaster_recordFunction · 0.85

Calls 3

freeFunction · 0.85
callocFunction · 0.85
strdupFunction · 0.70

Tested by

no test coverage detected