public method IO2GTradesTable.getNextRowByColumnValues

Brief

Gets the next row from IO2GTradesTable based on any of the column values.

Declaration
C++
virtual bool  getNextRowByColumnValues (const char *columnName, const int valueCount, const void *columnValues[], IO2GTableIterator &iterator, IO2GTradeTableRow *&row) = 0

Parameters
columnName

The name of a column in the Trades table. For example, OfferID.

valueCount

Number of values of the column.

columnValues

The values of the column specified by the columnName parameter. For example, if you want to search the Trades table for open positions by accounts 12345 and 23456, the columnName parameter value is AccountID, the columnValues parameter value is an array of 12345 and 23456, the valueCount parameter value is 2.

iterator

The table iterator.

row

[out] The row fetched.

Details

This method allows finding all rows that contain any of the specified column values.
If the row is not found, the method returns false.

Example

Get open positions by accounts 12345 and 23456 from the Trades table [hide]

    O2G2Ptr<IO2GTradesTable> tradesTable = (IO2GTradesTable *)tableManager->getTable(Trades);
    bool found = false;
    IO2GTableIterator iterator;
    IO2GTradeTableRow *trade = NULL;
    const void *columnValues[] = {(void *)"12345", (void *)"23456"};
    while (tradesTable->getNextRowByColumnValues("AccountID", 2, columnValues, iterator, trade))
    {
        found = true;
        std::cout << "TradeID: " << trade->getTradeID() <<
                     " OfferID = " << trade->getOfferID() <<
                     " Amount = " << trade->getAmount() << std::endl;
        trade->release();
    }
    if (!found)
        std::cout << "You don't have any open positions by specified accounts.");

Note: The returned row contains the current column values. The values are not automatically updated. To monitor changes, use IO2GTableListener.onChanged. The row interface is thread-safe. The returned row can be used in different threads without synchronization.

Declared in IO2GTradesTable

back