ibis::selected Class Reference

A data structure to store the select clause of a query. More...

#include <util.h>

List of all members.

Public Types

typedef std::vector
< std::string >
::const_iterator 
const_iterator
 An iterator through the column names of the select clause.
enum  FUNCTION {
  NIL, AVG, MAX, MIN,
  SUM, VARPOP, VARSAMP, STDPOP,
  STDSAMP, DISTINCT
}

Public Member Functions

const_iterator begin () const
void clear ()
bool empty () const
const_iterator end () const
uint32_t find (const char *key) const
 Return the first occurrence of the string.
FUNCTION getFunction (uint32_t i) const
const char * getName (uint32_t i) const
 Access the ith column name of the select clause.
const std::vector< std::string > & getNames () const
 Return the list of names stored internally.
std::string getTerm (uint32_t i) const
 Return the ith term, with the function name.
uint32_t nPlain () const
const char * operator* () const
 Output a stringlized version of the select clause.
const char * operator[] (uint32_t i) const
void remove (const std::vector< uint32_t > &ents)
 Remove the entries specified.
void select (const std::vector< const char * > &nl, bool sort=true)
void select (const char *str, bool sort=true)
 Parse the select clause. By default, place the functions last.
 selected (const char *str)
 The default constructor leaves data members empty.
uint32_t size () const
std::string uniqueNames () const
 Return all unique column names.


Detailed Description

A data structure to store the select clause of a query.

A select clause may contain a list of names plus a list of simple functions. The supported functions are avg, max, min and sum. Each of these functions can only take a single name as it argument.


Member Function Documentation

uint32_t ibis::selected::find ( const char *  key  )  const

Return the first occurrence of the string.

Use a simple linear search to locate the desired column name.

Returns the value of size if the given key in not in the list of selected components.

Referenced by ibis::query::result::getDouble(), ibis::query::result::getFloat(), ibis::query::result::getInt(), ibis::query::result::getLong(), ibis::query::result::getUInt(), ibis::query::result::getULong(), ibis::bundles::reorder(), and ibis::bundles::truncate().

const char* ibis::selected::getName ( uint32_t  i  )  const [inline]

Access the ith column name of the select clause.

In case of a function, it returns the name of the argument rather than the whole function. This operator is only intended to be used to extract the column values.

void ibis::selected::select ( const char *  str,
bool  sort = true 
)

Parse the select clause. By default, place the functions last.

Parse the incoming string into a list of names plus functions.

References ibis::util::delimiters, ibis::gVerbose, and ibis::util::logMessage().

Referenced by ibis::bundles::reorder(), selected(), ibis::query::setSelectClause(), and ibis::bundles::truncate().


The documentation for this class was generated from the following files:

Make It A Bit Faster