#include "SSTable.h"
ReVarPCifArray<int> * SSTable::SearchColumn(CifString & target,
CifString & colName,
int & errCode);
ReVarPCifArray<int> * SSTable::SearchColumn(CifString & target,
int colIndex,
int & errCode);
#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]);
}
}
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.
| 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. |
| 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. |
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.
| See also: | SearchColumns |
|---|