next up previous contents
Next: Debugging Methods Up: General Methods Previous: GetColumnNames

GetColumnIndex

NAME GetColumnIndex

PROTOTYPE

#include "SSTable.h"

int SSTable::GetColumnIndex(const char * columnName);

EXAMPLE

#include <string.h>
#include <stdlib.h>
#include "SSTable.h"
extern char ** ConvertRVCACifString(ReVarCifArray<CifString>*);

SSTable * pTable = new SSTable("MyTable");

... // add some columns and stuff

ReVarCifArray<CifString> * cifarray = pTable->GetColumnNames();
char ** colNames = ConvertRVCACifString(cifarray);

// sort the names
qsort(colNames, pTable->GetNumColumns(), sizeof(char *), strcmp);

// do something to each column, alphabetically
for (int i = 0; i < pTable->GetNumColumns(); i++) {
  int index = pTable->GetColumnIndex(colNames[i]);
  ...
}
PURPOSE

GetColumnIndex returns the index of the column with the given name.

RECEIVES

columnName The name of the column.

RETURN VALUE

An integer representing the position of the column in the table. For example, an index of 0 represents the 1st column.
A negative value means that an error has occured, i.e. the column with the specified name was not found in the table.

REMARKS

None  



Olivera Tosic
12/17/1999