------------------------------------------------------------------------------
| 162 | |
| 163 | //------------------------------------------------------------------------------ |
| 164 | int 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 | //------------------------------------------------------------------------------ |
| 192 | int vtkSQLDatabaseSchema::AddIndexToTable(int tblHandle, int idxType, const char* idxName) |
no test coverage detected