next up previous contents
Next: SearchColumns Up: Searching Methods Previous: Searching Methods

SearchColumn

NAME SearchColumn

PROTOTYPE

#include "SSTable.h"

ReVarPCifArray<int> * SSTable::SearchColumn(CifString & target,
                                            CifString & colName,
                                            int & errCode);
ReVarPCifArray<int> * SSTable::SearchColumn(CifString & target,
                                            int colIndex,
                                            int & errCode);

EXAMPLE

#include "SSTable.h"

SSTable s("MyTable");
...
CifString cs("Target"), col1("column1");
CifString newCS("New Value");
int errCode = 0;

ReVarPCifArray<int> * iArray;
iArray = s.SearchColumn(cs, col1, errCode);
if (iArray) {
  // update each instance of "Target" with "New Value"
  int colIndex = s.GetColumnIndex(col1.Text());
  for (int i = 0; i < iArray->Length(); i++) {
    s.UpdateCell(newCS, colIndex, *iArray[i]);
  }
}
PURPOSE

SearchColumn returns the row indices of cells in a column that are equal to a target. You can only search a column that was constructed with a tree index.

RECEIVES

SearchColumn(CifString &, CifString &, int &)
target The target string to search for.
colName The name of the column to search.
errCode A reference to an integer holding the error code resulting from this operation.

SearchColumn(CifString &, int, int &)
target The target string to search for.
colIndex The index of the column to search.
errCode A reference to an integer holding the error code resulting from this operation.

RETURN VALUE

A pointer to a ReVarPCifArray<int> holding the row indices of the cells containing the target string.
A NULL value indicates a possible error or an unsuccessful search.
A negative value in errCode indicates an error or warning.

REMARKS

See also: SearchColumns


next up previous contents
Next: SearchColumns Up: Searching Methods Previous: Searching Methods
Olivera Tosic
12/17/1999