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

Method AddColumnToIndex

IO/SQL/vtkSQLDatabaseSchema.cxx:137–161  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

135
136//------------------------------------------------------------------------------
137int vtkSQLDatabaseSchema::AddColumnToIndex(int tblHandle, int idxHandle, int colHandle)
138{
139 if (tblHandle < 0 || tblHandle >= this->GetNumberOfTables())
140 {
141 vtkErrorMacro("Cannot add column to index of non-existent table " << tblHandle);
142 return -1;
143 }
144
145 vtkSQLDatabaseSchemaInternals::Table* table = &this->Internals->Tables[tblHandle];
146 if (colHandle < 0 || colHandle >= static_cast<int>(table->Columns.size()))
147 {
148 vtkErrorMacro("Cannot add non-existent column " << colHandle << " in table " << tblHandle);
149 return -1;
150 }
151
152 if (idxHandle < 0 || idxHandle >= static_cast<int>(table->Indices.size()))
153 {
154 vtkErrorMacro(
155 "Cannot add column to non-existent index " << idxHandle << " of table " << tblHandle);
156 return -1;
157 }
158
159 table->Indices[idxHandle].ColumnNames.push_back(table->Columns[colHandle].Name);
160 return static_cast<int>(table->Indices[idxHandle].ColumnNames.size() - 1);
161}
162
163//------------------------------------------------------------------------------
164int vtkSQLDatabaseSchema::AddColumnToTable(

Callers 2

AddColumnToIndexFunction · 0.80

Calls 3

GetNumberOfTablesMethod · 0.95
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected