SystemPrinter Class Reference

Class for printing tables to the console output. More...

#include <SystemPrinter.h>

List of all members.

Public Member Functions

 SystemPrinter (const RelationAttributeInfo *attributes, int count)
 Constructor for SystemPrinter.
 SystemPrinter (const char *relName, const AttributeInfo *attributes, int count)
 Constructor for SystemPrinter.
 ~SystemPrinter ()
 Destructor for SystemPrinter.
void printHeader ()
 Prints a header for the table.
void printRecord (const char *data)
 Prints a record (tuple).
void printFooter ()
 Prints footer information.

Detailed Description

Class for printing tables to the console output.

Class for printing records of a table one at a time. This class must be used by your SystemManager::info and SystemManager::print methods, and it will be required for some QueryEngine methods as well.


Constructor & Destructor Documentation

SystemPrinter::SystemPrinter ( const RelationAttributeInfo attributes,
int  count 
)

Constructor for SystemPrinter.

Parameters:
attributes Array of <attribute, relation name> pairs
count Length of the array

Constructor for SystemPrinter. Creates a deep copy of the array of RelationAttributeInfo structures. These will be used to print the header information, as well as to interpret the contents of records during calls to SystemPrinter::printRecord. This version of the constructor is useful when printing tables corresponding to query results (when different attributes may be associated with different relations).

SystemPrinter::SystemPrinter ( const char *  relName,
const AttributeInfo attributes,
int  count 
)

Constructor for SystemPrinter.

Parameters:
relName The name of the relation
attributes Array of attribute descriptors
count Length of the array

Constructor for SystemPrinter. Creates a deep copy of the array of RelationAttributeInfo structures. These will be used to print the header information, as well as to interpret the contents of records during calls to SystemPrinter::printRecord. This version of the constructor is useful when printing base tables (where each attribute is associated with the same relation).


Member Function Documentation

void SystemPrinter::printFooter (  ) 

Prints footer information.

This method prints to stdout footer information about the number of records printed via calls to SystemPrinter::printRecord. This method should be called once, after the last record has been printed.

void SystemPrinter::printHeader (  ) 

Prints a header for the table.

This method prints header information to stdout. Each attribute name is printed, along with its relation name. A row of dashes is then printed. This method should be called once, before printing any actual tuples.

void SystemPrinter::printRecord ( const char *  data  ) 

Prints a record (tuple).

Parameters:
data A pointer to the record data

Prints a record to stdout, using the typing information supplied by the RelationalAttributeInfo array passed to the class constructor. The length of the array of bytes pointed to be the data parameter should be the sum of the lengths of the attributes in that array.


The documentation for this class was generated from the following files:
Generated on Sun May 16 23:18:41 2010 for DavisDB by  doxygen 1.6.3