ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 > Class Template Reference

In-memory representation of a database table. More...

#include <SqlDatabase.h>

Collaboration diagram for SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >:

Classes

struct  Renderers
 Functors for rendering column values. More...
 
struct  Tuple
 One row of a table. More...
 

Public Types

enum  { MAXCOLS =16 }
 
typedef std::vector< TupleRows
 All rows of a table. More...
 

Public Member Functions

 Table ()
 Creates a new, empty table. More...
 
 Table (const StatementPtr &stmt)
 Creates a new table and initializes it by running the specified database query. More...
 
size_t size () const
 Return the number of rows in the table. More...
 
bool empty () const
 Returns true if table has no rows. More...
 
void clear ()
 Clear the table by removing all rows. More...
 
void insert (const StatementPtr &stmt)
 Insert more rows into a table by running the specified query. More...
 
template<typename T >
std::string render (const Renderer< T > *r, const T &value, size_t width=0) const
 Render a single value. More...
 
std::vector< size_t > colsizes () const
 Compute column widths. More...
 
void print_headers (std::ostream &out, const std::vector< size_t > &widths) const
 Print the headers for a table. More...
 
void print_rowsep (std::ostream &out, const std::vector< size_t > &widths) const
 Print the row separator that goes between the headers and the data. More...
 
void print_row (std::ostream &out, const Tuple &t, const std::vector< size_t > &widths) const
 Print one row of a table. More...
 
void print (std::ostream &out) const
 Print all rows of the table to the specified stream. More...
 
void header (int colnum, const std::string &hdr)
 Headers to use when printing the table. More...
 
const std::string & header (int colnum) const
 Headers to use when printing the table. More...
 
void headers (const std::string &h0, const std::string &h1="", const std::string &h2="", const std::string &h3="", const std::string &h4="", const std::string &h5="", const std::string &h6="", const std::string &h7="", const std::string &h8="", const std::string &h9="", const std::string &h10="", const std::string &h11="", const std::string &h12="", const std::string &h13="", const std::string &h14="", const std::string &h15="")
 Headers to use when printing the table. More...
 
void reprint_headers (size_t nrows)
 How often should headers be reprinted? More...
 
size_t reprint_headers () const
 How often should headers be reprinted? More...
 
Renderersrenderers ()
 Accessor for value renderers. More...
 
const Renderersrenderers () const
 Accessor for value renderers. More...
 
void prepost (PrePostRow< Table > *pre, PrePostRow< Table > *post)
 Accessor for functors called before and after each row is printed. More...
 
std::pair< PrePostRow< Table >
*, PrePostRow< Table > * > 
prepost () const
 Accessor for functors called before and after each row is printed. More...
 
Tupleoperator[] (size_t i)
 Return a reference to a particular row. More...
 
const Tupleoperator[] (size_t i) const
 Return a reference to a particular row. More...
 
void insert (const Tuple &tuple)
 Add a new row to the end of the table. More...
 
void insert (const T00 &v00, const T01 &v01=T01(), const T02 &v02=T02(), const T03 &v03=T03(), const T04 &v04=T04(), const T05 &v05=T05(), const T06 &v06=T06(), const T07 &v07=T07(), const T08 &v08=T08(), const T09 &v09=T09(), const T10 &v10=T10(), const T11 &v11=T11(), const T12 &v12=T12(), const T13 &v13=T13(), const T14 &v14=T14(), const T15 &v15=T15())
 Add a new row to the end of the table. More...
 
void line_prefix (const std::string &s)
 String to print at the beginning of every line of output. More...
 
const std::string & line_prefix () const
 String to print at the beginning of every line of output. More...
 

Private Attributes

std::vector< std::string > headers_
 
Renderers render_
 
Rows rows_
 
std::string colsep_
 
PrePostRow< Table > * pre_row_
 
PrePostRow< Table > * post_row_
 
size_t reprint_headers_
 
std::string prefix_
 

Detailed Description

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
class SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >

In-memory representation of a database table.

These can be used to hold results of a database table, to build a table in memory, or (mostly) for printing a table in an easy-to-read format. For instance, here's a very simple, no-frills way to print the results from a query:

SqlDatabase::StatementPtr stmt = tx->statement("select id, ninsns, name, addr from table where ninsns = ?");

Tables can also be used to operate on the results of a query. For instance, to calculate the average number of instructions and bytes per function, one could use a counting-loop-over-array paradigm, which is more comfortable to some programmers than iterators:

typedef SqlDatabase::Table<size_t, size_t> InsnBytesTable;
InsnBytesTable table(tx->statement("select ninsns, bytes from functions"));
size_t ninsns_sum=0, nbytes_sum=0;
for (size_t i=0; i<table.size(); ++i) {
ninsns_sum += table[i].v0; // value from column #0
nbytes_sum += table[i].v1; // value from column #1
}
std::cout <<"average number of instructions: " <<(double)ninsns_sum/table.size() <<"\n"
<<"average size in bytes: " <<(double)nbytes_sum/table.size() <<"\n";

Tables can also accumulate the results from more than one query as long as those queries return the same number of columns and column types:

MyTable.insert(tx->query("select id, ninsns, name from functions where size < ?")->bind(0, 100));
MyTable.insert(tx->query("select hashval, size, desc from failures"));

If you want headers at the top of a printed table, give the columns names like this:

ResultsTable table(stmt->bind(0, ninsns));
table.headers("Id", "NInsns", "Name", "Address");

It is also possible to specify a rendering for certain columns. For instance, the query above returns an address of type rose_addr_t for column #3 (column numbering is always zero-origin). If we want the address to be formatted as a zero-padded, eight character hexadecimal number with a "0x" prefix, then we could do that with code like this (building from the previous example):

struct AddrRenderer: SqlDatabase::Renderer<rose_addr_t> {
std::string operator()(const rose_addr_t &value, size_t width) const override {
}
} addressRenderer;
table.renderers().r3 = &addrRenderer;

If we want the headers to be printed again every 50th row, we can do that with a PrePostRow functor. These functors have row info available to them so they can do fancier things too, like printing separators between major portions of a table.

struct PeriodicSeparator: SqlDatabase::PrePostRow<ResultsTable> {
void operator()(std::ostream &out, const ResultsTable *table, size_t rownum, const std::vector<size_t> &widths) {
if (0!=rownum && 0==rownum % 50)
table->print_rowsep(out, widths);
}
} periodicSeparator;
table.prepost(&periodicSeparator, NULL);

Definition at line 677 of file SqlDatabase.h.

Member Typedef Documentation

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
typedef std::vector<Tuple> SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Rows

All rows of a table.

Definition at line 714 of file SqlDatabase.h.

Member Enumeration Documentation

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
anonymous enum
Enumerator
MAXCOLS 

Maximum number of columns allowed in a table.

Definition at line 679 of file SqlDatabase.h.

Constructor & Destructor Documentation

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Table ( )
inline

Creates a new, empty table.

Definition at line 717 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Table ( const StatementPtr stmt)
inlineexplicit

Creates a new table and initializes it by running the specified database query.

Definition at line 720 of file SqlDatabase.h.

Member Function Documentation

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::header ( int  colnum,
const std::string &  hdr 
)
inline

Headers to use when printing the table.

Definition at line 727 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
const std::string& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::header ( int  colnum) const
inline

Headers to use when printing the table.

Definition at line 731 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::headers ( const std::string &  h0,
const std::string &  h1 = "",
const std::string &  h2 = "",
const std::string &  h3 = "",
const std::string &  h4 = "",
const std::string &  h5 = "",
const std::string &  h6 = "",
const std::string &  h7 = "",
const std::string &  h8 = "",
const std::string &  h9 = "",
const std::string &  h10 = "",
const std::string &  h11 = "",
const std::string &  h12 = "",
const std::string &  h13 = "",
const std::string &  h14 = "",
const std::string &  h15 = "" 
)
inline

Headers to use when printing the table.

Definition at line 735 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::reprint_headers ( size_t  nrows)
inline

How often should headers be reprinted?

Definition at line 748 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
size_t SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::reprint_headers ( ) const
inline

How often should headers be reprinted?

Definition at line 749 of file SqlDatabase.h.

template<typename T00 , typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
Renderers& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::renderers ( )
inline

Accessor for value renderers.

Use these to change how values are displayed. For instance, if a column has values that are addresses and you want to display them with StringUtility::addrToString(), then use code like this:

struct AddrRender: SqlDatabase::Renderer<rose_addr_t> {
std::string operator()(const rose_addr_t &value, size_t width) const override {
}
} addrRender;
table.renderers().r2 = &addrRenderer;

The render pointer should not be deleted before the table is done being used.

Definition at line 768 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
const Renderers& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::renderers ( ) const
inline

Accessor for value renderers.

Use these to change how values are displayed. For instance, if a column has values that are addresses and you want to display them with StringUtility::addrToString(), then use code like this:

struct AddrRender: SqlDatabase::Renderer<rose_addr_t> {
std::string operator()(const rose_addr_t &value, size_t width) const override {
}
} addrRender;
table.renderers().r2 = &addrRenderer;

The render pointer should not be deleted before the table is done being used.

Definition at line 769 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::prepost ( PrePostRow< Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 > > *  pre,
PrePostRow< Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 > > *  post 
)
inline

Accessor for functors called before and after each row is printed.

Definition at line 774 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
std::pair<PrePostRow<Table>*, PrePostRow<Table>*> SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::prepost ( ) const
inline

Accessor for functors called before and after each row is printed.

Definition at line 778 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
size_t SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::size ( void  ) const
inline

Return the number of rows in the table.

Definition at line 784 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
bool SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::empty ( ) const
inline

Returns true if table has no rows.

Definition at line 787 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::clear ( )
inline

Clear the table by removing all rows.

Definition at line 790 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
Tuple& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::operator[] ( size_t  i)
inline

Return a reference to a particular row.

Definition at line 794 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
const Tuple& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::operator[] ( size_t  i) const
inline

Return a reference to a particular row.

Definition at line 795 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::insert ( const Tuple tuple)
inline

Add a new row to the end of the table.

Definition at line 801 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::insert ( const T00 &  v00,
const T01 &  v01 = T01(),
const T02 &  v02 = T02(),
const T03 &  v03 = T03(),
const T04 &  v04 = T04(),
const T05 &  v05 = T05(),
const T06 &  v06 = T06(),
const T07 &  v07 = T07(),
const T08 &  v08 = T08(),
const T09 &  v09 = T09(),
const T10 &  v10 = T10(),
const T11 &  v11 = T11(),
const T12 &  v12 = T12(),
const T13 &  v13 = T13(),
const T14 &  v14 = T14(),
const T15 &  v15 = T15() 
)
inline

Add a new row to the end of the table.

Definition at line 802 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::insert ( const StatementPtr stmt)
inline

Insert more rows into a table by running the specified query.

The table is not cleared first.

Definition at line 811 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::line_prefix ( const std::string &  s)
inline

String to print at the beginning of every line of output.

Definition at line 822 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
const std::string& SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::line_prefix ( ) const
inline

String to print at the beginning of every line of output.

Definition at line 823 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
template<typename T >
std::string SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::render ( const Renderer< T > *  r,
const T &  value,
size_t  width = 0 
) const
inline

Render a single value.

Definition at line 828 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
std::vector<size_t> SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::colsizes ( ) const
inline

Compute column widths.

Column widths are computed by internally printing the rows of the table and measuring the maximum width for each column. The renderers are called with zero for the column widths.

Definition at line 840 of file SqlDatabase.h.

References max.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::print_headers ( std::ostream &  out,
const std::vector< size_t > &  widths 
) const
inline

Print the headers for a table.

Definition at line 864 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::print_rowsep ( std::ostream &  out,
const std::vector< size_t > &  widths 
) const
inline

Print the row separator that goes between the headers and the data.

Definition at line 885 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::print_row ( std::ostream &  out,
const Tuple t,
const std::vector< size_t > &  widths 
) const
inline

Print one row of a table.

Definition at line 915 of file SqlDatabase.h.

References SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v0, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v1, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v10, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v11, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v12, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v13, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v14, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v15, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v2, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v3, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v4, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v5, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v6, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v7, SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v8, and SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::Tuple::v9.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
void SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::print ( std::ostream &  out) const
inline

Print all rows of the table to the specified stream.

Definition at line 937 of file SqlDatabase.h.

References max.

Member Data Documentation

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
std::vector<std::string> SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::headers_
private

Definition at line 976 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
Renderers SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::render_
private

Definition at line 977 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
Rows SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::rows_
private

Definition at line 978 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
std::string SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::colsep_
private

Definition at line 979 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
PrePostRow<Table>* SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::pre_row_
private

Definition at line 980 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
PrePostRow<Table> * SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::post_row_
private

Definition at line 980 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
size_t SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::reprint_headers_
private

Definition at line 981 of file SqlDatabase.h.

template<typename T00, typename T01 = NoColumn, typename T02 = NoColumn, typename T03 = NoColumn, typename T04 = NoColumn, typename T05 = NoColumn, typename T06 = NoColumn, typename T07 = NoColumn, typename T08 = NoColumn, typename T09 = NoColumn, typename T10 = NoColumn, typename T11 = NoColumn, typename T12 = NoColumn, typename T13 = NoColumn, typename T14 = NoColumn, typename T15 = NoColumn>
std::string SqlDatabase::Table< T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15 >::prefix_
private

Definition at line 982 of file SqlDatabase.h.


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