RCSB PDB Protein Data Bank A Member of the wwPDB
An Information Portal to Biological Macromolecular Structures
PDB Home | Contact Us
next up previous contents
Next: RenameColumn Up: Column methods Previous: AddColumn

InsertColumn

NAME InsertColumn

PROTOTYPE

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

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

EXAMPLE

#include "ISTable.h"

...
ISTable * pTable = new ISTable();
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());
pTable->InsertColumn("MiddleColumn", pTable->GetNumColumns()/2,
  ISTable::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.
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.
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

It is safe to use this method after index creation.

See also: FillColumn
  Column Option Constants


next up previous contents
Next: RenameColumn Up: Column methods Previous: AddColumn
Olivera Tosic
6/12/2002

 

© RCSB PDB