#include "SSTable.h"
ReVarPCifArray<int> * SSTable::SearchColumns(
ReVarCifArray<CifString> & targets,
ReVarCifArray<CifString> & colNames,
int & errCode);
ReVarPCifArray<int> * SSTable::SearchColumns(
ReVarCifArray<CifString> & targets,
ReVarPCifArray<int> & colIds,
int & errCode);
#include "SSTable.h"
SSTable s("MyTable");
...
CifString cs("Hello"), cs2("World"), col1("A"), col2("B"), col3("C");
CifString newCS("!");
int errCode = 0;
ReVarCifArray<CifString> vals, names;
vals.Add(cs); vals.Add(cs2);
names.Add(col1); names.Add(col2);
ReVarPCifArray<int> * iArray;
// Search column "A" for "Hello" and column "B" for "World"
iArray = s.SearchColumns(vals, names, errCode);
if (iArray) {
int colIndex = s.GetColumnIndex(col3.Text());
for (int i = 0; i < iArray->Length(); i++) {
s.UpdateCell(newCS, colIndex, *iArray[i]);
}
}
SearchColumns returns the row indices where all of the target strings match in their respective columns. This method is the equalivalent of searching multiple columns with SearchColumn and then doing a SetIntersect on them. It may be more efficient though. You can only search columns that were constructed with a tree index.
| targets | An array of target strings to search for. |
| colName | An array of column names indicating which columns should be searched. |
| errCode | A reference to an integer holding the error code resulting from this operation. |
| targets | An array of target strings to search for. |
| colIds | An array of column indices indicating which columns should be searched. |
| errCode | A reference to an integer holding the error code resulting from this operation. |
A pointer to a ReVarPCifArray<int> holding the row indices having matches in all of the columns specified.
A NULL value indicates a possible error or an unsuccessful search.
A negative value in errCode indicates an error or warning.
| See also: | SearchColumn |
|---|