MCPcopy Create free account
hub / github.com/MariaDB/server / ColDB

Method ColDB

storage/connect/table.cpp:125–173  ·  view source on GitHub ↗

/ Initialize TDB based column description block construction. */ name is used to call columns by name. */ num is used by TBL to construct columns by index number. */ Note: name=Null and num=0 for constructing all columns (select *) */ /

Source from the content-addressed store, hash-verified

123/* Note: name=Null and num=0 for constructing all columns (select *) */
124/***********************************************************************/
125PCOL TDB::ColDB(PGLOBAL g, PSZ name, int num)
126{
127 int i;
128 PCOLDEF cdp;
129 PCOL cp, colp = NULL, cprec = NULL;
130
131 if (trace(1))
132 htrc("ColDB: am=%d colname=%s tabname=%s num=%d\n",
133 GetAmType(), SVP(name), Name, num);
134
135 for (cdp = To_Def->GetCols(), i = 1; cdp; cdp = cdp->GetNext(), i++)
136 if ((!name && !num) ||
137 (name && !stricmp(cdp->GetName(), name)) || num == i) {
138 /*****************************************************************/
139 /* Check for existence of desired column. */
140 /* Also find where to insert the new block. */
141 /*****************************************************************/
142 for (cp = Columns; cp; cp = cp->GetNext())
143 if ((num && cp->GetIndex() == i) ||
144 (name && !stricmp(cp->GetName(), name)))
145 break; // Found
146 else if (cp->GetIndex() < i)
147 cprec = cp;
148
149 if (trace(1))
150 htrc("cdp(%d).Name=%s cp=%p\n", i, cdp->GetName(), cp);
151
152 /*****************************************************************/
153 /* Now take care of Column Description Block. */
154 /*****************************************************************/
155 if (cp)
156 colp = cp;
157 else if (!(cdp->Flags & U_SPECIAL))
158 colp = MakeCol(g, cdp, cprec, i);
159 else if (Mode != MODE_INSERT)
160 colp = InsertSpcBlk(g, cdp);
161
162 if (trace(1))
163 htrc("colp=%p\n", colp);
164
165 if (name || num)
166 break;
167 else if (colp && !colp->IsSpecial())
168 cprec = colp;
169
170 } // endif Name
171
172 return (colp);
173} // end of ColDB
174
175/***********************************************************************/
176/* InsertSpecialColumn: Put a special column ahead of the column list.*/

Callers 6

CntOpenTableFunction · 0.45
InitMethod · 0.45
MakeColumnListMethod · 0.45
CheckColumnListMethod · 0.45
CondFilterMethod · 0.45
MakePivotColumnsMethod · 0.45

Calls 6

IsSpecialMethod · 0.80
htrcFunction · 0.70
GetAmTypeFunction · 0.70
MakeColFunction · 0.70
GetNextMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected