MCPcopy Create free account
hub / github.com/Kitware/VTK / AddColumnToTable

Method AddColumnToTable

IO/SQL/vtkSQLDatabaseSchema.cxx:164–189  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

162
163//------------------------------------------------------------------------------
164int vtkSQLDatabaseSchema::AddColumnToTable(
165 int tblHandle, int colType, const char* colName, int colSize, const char* colOpts)
166{
167 if (!colName)
168 {
169 vtkErrorMacro("Cannot add column with empty name to table " << tblHandle);
170 return -1;
171 }
172
173 if (tblHandle < 0 || tblHandle >= this->GetNumberOfTables())
174 {
175 vtkErrorMacro("Cannot add column to non-existent table " << tblHandle);
176 return -1;
177 }
178
179 // DCT: This trick avoids copying a Column structure the way push_back would:
180 int colHandle = static_cast<int>(this->Internals->Tables[tblHandle].Columns.size());
181 this->Internals->Tables[tblHandle].Columns.resize(colHandle + 1);
182 vtkSQLDatabaseSchemaInternals::Column* column =
183 &this->Internals->Tables[tblHandle].Columns[colHandle];
184 column->Type = static_cast<DatabaseColumnType>(colType);
185 column->Size = colSize;
186 column->Name = colName;
187 column->Attributes = colOpts;
188 return colHandle;
189}
190
191//------------------------------------------------------------------------------
192int vtkSQLDatabaseSchema::AddIndexToTable(int tblHandle, int idxType, const char* idxName)

Callers 2

AddColumnToTableFunction · 0.80

Calls 3

GetNumberOfTablesMethod · 0.95
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected