Public Member Functions | Protected Attributes | Friends | List of all members
ibis::fromClause Class Reference

A class to represent the from clause. More...

#include <fromClause.h>

Public Member Functions

const char * alias (const char *) const
 Given a name find its alias. More...
 
void clear ()
 Remove the current content.
 
bool empty () const
 Is it empty? Returns true or false.
 
 fromClause (const char *cl=0)
 Parse a new string as a from clause.
 
 fromClause (const ibis::table::stringArray &)
 Parse a list of strings.
 
 fromClause (const fromClause &)
 Copy constructor. Deep copy.
 
const ibis::compRangegetJoinCondition () const
 Report the join condition.
 
void getNames (ibis::table::stringArray &) const
 Fill the array nms with the known names. More...
 
const char * getString (void) const
 Return a pointer to the string form of the from clause.
 
const char * operator* (void) const
 Dereferences to the string form of the from clause.
 
fromClauseoperator= (const fromClause &rhs)
 Assignment operator.
 
int parse (const char *cl)
 Parse a new string. More...
 
size_t position (const char *) const
 
void print (std::ostream &) const
 Print the content. More...
 
const char * realName (const char *) const
 Given an alias find its real name. More...
 
void reorderNames (const char *, const char *)
 Reorder the table names. More...
 
uint32_t size () const
 Returns the number of valid names.
 
void swap (fromClause &rhs)
 Swap the content of two from clauses.
 

Protected Attributes

std::vector< std::string > aliases_
 The aliases.
 
std::string clause_
 
ibis::compRangejcond_
 The join condition. More...
 
ibis::fromLexerlexer
 !< String version of the from clause.
 
std::vector< std::string > names_
 The names of data tables.
 
std::map< const char *, size_t, ibis::lessi > ordered_
 The ordered version of the names.
 

Friends

class ibis::fromParser
 !< A pointer for the parser.
 

Detailed Description

A class to represent the from clause.

It parses a string into a list of names, a list of aliases and a join expression if present.

The alias may optionally be preceded by the keyword "AS". For example, "FROM table_a as a" and "FROM table_a a" mean the same thing.

The join expression is in the from clause can be of the form

table_a JOIN table_b USING join_column

or

table_a JOIN table_b ON arithmetic_expression

Note that the first form is equivalent to

table_a JOIN table_b ON table_a.join_column = table_b.join_column
Warning
The current version of FastBit only supports join operating on two data tables.

Member Function Documentation

const char * ibis::fromClause::alias ( const char *  al) const

Given a name find its alias.

The incoming argument will be returned if it is neither an alias nor an actual table name mentioned in the from clause.

Referenced by ibis::quaere::create().

void ibis::fromClause::getNames ( ibis::table::stringArray nms) const

Fill the array nms with the known names.

It returns both actual table names and their aliases in alphabetic order.

References ibis::array_t< T >::clear(), ibis::array_t< T >::push_back(), and ibis::array_t< T >::reserve().

int ibis::fromClause::parse ( const char *  cl)

Parse a new string.

Clear the existing content. A minimal amount of sanity check is also performed.

References ibis::util::clear().

Referenced by fromClause().

void ibis::fromClause::print ( std::ostream &  out) const

Print the content.

Write a string version of the from clause to the specified output stream.

const char * ibis::fromClause::realName ( const char *  al) const

Given an alias find its real name.

The input string will be returned if it is neither an alias nor an actual table name mentioned in the from clause.

Referenced by ibis::quaere::create().

void ibis::fromClause::reorderNames ( const char *  nm0,
const char *  nm1 
)

Reorder the table names.

The name matching nm0 will be placed first, followed by the one matching nm1.

Referenced by ibis::quaere::create().

Member Data Documentation

ibis::compRange* ibis::fromClause::jcond_
protected

The join condition.

A join condition may be specified in the from clause with the key words ON and USING, where On is followed by an arithmetic expression and USING is followed by a column name. The parser will translate the column name following USING into an eqaulity condition for generate a proper ibis::compRange object. If this variable is a nil pointer, no join condition has been specified in the from clause.

Referenced by fromClause(), getJoinCondition(), and swap().


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive