next up previous contents
Next: FillColumn Up: Column methods Previous: AddColumn

InsertColumn

NAME InsertColumn

PROTOTYPE

#include "SSTable.h"
int SSTable::InsertColumn(const char * newColumnName,
                          int destination, int makeTree = 0,
                          char opts = DEFAULT_OPTIONS);

int SSTable::InsertColumn(ReVarCifArray<CifString> & theCol,
                          const char * newColumnName,
                          int destination, int makeTree = 0,
                          char opts = DEFAULT_OPTIONS);

EXAMPLE

#include "SSTable.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
...
SSTable * pTable = new SSTable();
ReVarCifArray<CifString> last_column;
CifString cs;

while (tokenizer.hasMoreTokens()) {
  cs = (char *) tokenizer.GetNextToken();
  last_column.Add(cs);
  cs.Clear();
}

// put a column in 1st position ...
pTable->InsertColumn("FirstColumn", 0);
pTable->InsertColumn(last_column, "LastColumn",
  pTable->GetNumColumns(), TRUE);
pTable->InsertColumn("MiddleColumn", pTable->GetNumColumns()/2,
  TRUE, SSTable::DT_INTEGER);
PURPOSE

InsertColumn inserts a column into the table at a specified location. The second form of this method also adds data into the table. The first form of the method requires calling another method, such as FillColumn, to add data to the table.

RECEIVES

InsertColumn(const char *, int, int, char)
newColumnName The name of the new column. The column name must be unique to the table.
destination The index where the column is to be placed. Keep in mind that the first column is column 0.
makeTree If zero, no index will be constructed on the column, which will not be searchable. Set to a positive number if the column is to be searchable. Has a default value of 0.
opts Sets the options for the column. These include the datatype, case sensitivity, and white space sensitivity for comparisions. Has a default value indicating a column of strings, with case and white space sensitivity.

InsertColumn(ReVarCifArray<CifString>&, const char *, int, int, char)
theCol An array of CifStrings to add as the data of the column. Even if the datatype of the column is not of string type, it needs to be put into the table as CifStrings.
newColumnName The name of the new column. The column name must be unique to the table.
destination The index where the column is to be placed. Keep in mind that the first column is column 0.
makeTree If zero, no index will be constructed on the column, which will not be searchable. Set to a positive number if the column is to be searchable. Has a default value of 0.
opts Sets the options for the column. These include the datatype, case sensitivity, and white space sensitivity for comparisions. Has a default value indicating a column of strings, with case and white space sensitivity.

RETURN VALUE

A negative value indicates an error or warning.

REMARKS

See also: FillColumn
  Column Option Constants


next up previous contents
Next: FillColumn Up: Column methods Previous: AddColumn
Olivera Tosic
12/17/1999