MySQL++  3.3.0
Classes | Functions
vallist.h File Reference

Declares templates for holding lists of values. More...

#include "manip.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  mysqlpp::equal_list_ba< Seq1, Seq2, Manip >
 Holds two lists of items, typically used to construct a SQL "equals clause". More...
 
struct  mysqlpp::equal_list_b< Seq1, Seq2, Manip >
 Same as equal_list_ba, plus the option to have some elements of the equals clause suppressed. More...
 
struct  mysqlpp::value_list_ba< Seq, Manip >
 Holds a list of items, typically used to construct a SQL "value list". More...
 
struct  mysqlpp::value_list_b< Seq, Manip >
 Same as value_list_ba, plus the option to have some elements of the list suppressed. More...
 

Functions

template<class Seq1 , class Seq2 , class Manip >
std::ostream & mysqlpp::operator<< (std::ostream &o, const equal_list_ba< Seq1, Seq2, Manip > &el)
 Inserts an equal_list_ba into an std::ostream. More...
 
template<class Seq1 , class Seq2 , class Manip >
std::ostream & mysqlpp::operator<< (std::ostream &o, const equal_list_b< Seq1, Seq2, Manip > &el)
 Same as operator<< for equal_list_ba, plus the option to suppress insertion of some list items in the stream. More...
 
template<class Seq , class Manip >
std::ostream & mysqlpp::operator<< (std::ostream &o, const value_list_ba< Seq, Manip > &cl)
 Inserts a value_list_ba into an std::ostream. More...
 
template<class Seq , class Manip >
std::ostream & mysqlpp::operator<< (std::ostream &o, const value_list_b< Seq, Manip > &cl)
 Same as operator<< for value_list_ba, plus the option to suppress insertion of some list items in the stream. More...
 
void mysqlpp::create_vector (size_t size, std::vector< bool > &v, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Create a vector of bool with the given arguments as values. More...
 
template<class Container >
void mysqlpp::create_vector (const Container &c, std::vector< bool > &v, std::string s0, std::string s1, std::string s2, std::string s3, std::string s4, std::string s5, std::string s6, std::string s7, std::string s8, std::string s9, std::string sa, std::string sb, std::string sc)
 Create a vector of bool using a list of named fields. More...
 
template<class Seq >
value_list_ba< Seq, do_nothing_type0 > mysqlpp::value_list (const Seq &s, const char *d=",")
 Constructs a value_list_ba. More...
 
template<class Seq , class Manip >
value_list_ba< Seq, Manip > mysqlpp::value_list (const Seq &s, const char *d, Manip m)
 Constructs a value_list_ba. More...
 
template<class Seq , class Manip >
value_list_b< Seq, Manip > mysqlpp::value_list (const Seq &s, const char *d, Manip m, const std::vector< bool > &vb)
 Constructs a value_list_b (sparse value list) More...
 
template<class Seq , class Manip >
value_list_b< Seq, Manip > mysqlpp::value_list (const Seq &s, const char *d, Manip m, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a value_list_b (sparse value list) More...
 
template<class Seq >
value_list_b< Seq, do_nothing_type0 > mysqlpp::value_list (const Seq &s, const char *d, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a sparse value list. More...
 
template<class Seq >
value_list_b< Seq, do_nothing_type0 > mysqlpp::value_list (const Seq &s, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a sparse value list. More...
 
template<class Seq1 , class Seq2 >
equal_list_ba< Seq1, Seq2, do_nothing_type0 > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d=",", const char *e=" = ")
 Constructs an equal_list_ba. More...
 
template<class Seq1 , class Seq2 , class Manip >
equal_list_ba< Seq1, Seq2, Manip > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, Manip m)
 Constructs an equal_list_ba. More...
 
template<class Seq1 , class Seq2 , class Manip >
equal_list_b< Seq1, Seq2, Manip > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, Manip m, const std::vector< bool > &vb)
 Constructs a equal_list_b (sparse equal list) More...
 
template<class Seq1 , class Seq2 , class Manip >
equal_list_b< Seq1, Seq2, Manip > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, Manip m, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a equal_list_b (sparse equal list) More...
 
template<class Seq1 , class Seq2 >
equal_list_b< Seq1, Seq2, do_nothing_type0 > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a equal_list_b (sparse equal list) More...
 
template<class Seq1 , class Seq2 >
equal_list_b< Seq1, Seq2, do_nothing_type0 > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, const char *d, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a equal_list_b (sparse equal list) More...
 
template<class Seq1 , class Seq2 >
equal_list_b< Seq1, Seq2, do_nothing_type0 > mysqlpp::equal_list (const Seq1 &s1, const Seq2 &s2, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false, bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false, bool tc=false)
 Constructs a equal_list_b (sparse equal list) More...
 

Detailed Description

Declares templates for holding lists of values.

Function Documentation

◆ create_vector() [1/2]

template<class Container >
void mysqlpp::create_vector ( const Container &  c,
std::vector< bool > &  v,
std::string  s0,
std::string  s1,
std::string  s2,
std::string  s3,
std::string  s4,
std::string  s5,
std::string  s6,
std::string  s7,
std::string  s8,
std::string  s9,
std::string  sa,
std::string  sb,
std::string  sc 
)

Create a vector of bool using a list of named fields.

This function is used with the ResUse and Result containers, which have a field_num() member function that maps a field name to its position number. So for each named field, we set the bool in the vector at the corresponding position to true.

This function is used within the library to build the vector used in calling the vector form of Row::equal_list(), Row::value_list(), and Row::field_list(). See the "Harnessing SSQLS Internals" section of the user manual to see that feature at work.

◆ create_vector() [2/2]

void mysqlpp::create_vector ( size_t  size,
std::vector< bool > &  v,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Create a vector of bool with the given arguments as values.

This function takes up to 13 bools, with the size parameter controlling the actual number of parameters we pay attention to.

This function is used within the library to build the vector used in calling the vector form of Row::equal_list(), Row::value_list(), and Row::field_list(). See the "Harnessing SSQLS Internals" section of the user manual to see that feature at work.

◆ equal_list() [1/7]

template<class Seq1 , class Seq2 >
equal_list_b<Seq1, Seq2, do_nothing_type0> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a equal_list_b (sparse equal list)

Same as equal_list(Seq&, Seq&, const char*, bool, bool...) except that it doesn't take the const char* argument. It uses a comma for the delimiter. This form is useful for building simple equals lists, where no manipulators are necessary, and the default delimiter and equals symbol are suitable.

References mysqlpp::do_nothing, and mysqlpp::equal_list().

◆ equal_list() [2/7]

template<class Seq1 , class Seq2 >
equal_list_b<Seq1, Seq2, do_nothing_type0> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a equal_list_b (sparse equal list)

Same as equal_list(Seq&, Seq&, const char*, const char*, bool, bool...) except that it doesn't take the second const char* argument. It uses " = " for the equals symbol.

References mysqlpp::do_nothing, and mysqlpp::equal_list().

◆ equal_list() [3/7]

template<class Seq1 , class Seq2 >
equal_list_b<Seq1, Seq2, do_nothing_type0> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d,
const char *  e,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a equal_list_b (sparse equal list)

Same as equal_list(Seq&, Seq&, const char*, const char*, Manip, bool, bool...) except that it doesn't take the Manip argument. It uses the do_nothing manipulator instead, meaning that none of the elements are escaped when being inserted into a stream.

References mysqlpp::do_nothing, and mysqlpp::equal_list().

◆ equal_list() [4/7]

template<class Seq1 , class Seq2 , class Manip >
equal_list_ba<Seq1, Seq2, Manip> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d,
const char *  e,
Manip  m 
)

Constructs an equal_list_ba.

Same as equal_list(Seq&, Seq&, const char*, const char*) except that it also lets you specify the manipulator. Use this version if the data must be escaped or quoted when being inserted into a stream.

References mysqlpp::equal_list().

◆ equal_list() [5/7]

template<class Seq1 , class Seq2 , class Manip >
equal_list_b<Seq1, Seq2, Manip> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d,
const char *  e,
Manip  m,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a equal_list_b (sparse equal list)

Same as equal_list(Seq&, Seq&, const char*, const char*, Manip, vector<bool>&) except that it takes boolean parameters instead of a list of bools.

References mysqlpp::equal_list().

◆ equal_list() [6/7]

template<class Seq1 , class Seq2 , class Manip >
equal_list_b<Seq1, Seq2, Manip> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d,
const char *  e,
Manip  m,
const std::vector< bool > &  vb 
)

Constructs a equal_list_b (sparse equal list)

Same as equal_list(Seq&, Seq&, const char*, const char*, Manip) except that you can pass a vector of bools. For each true item in that list, operator<< adds the corresponding item is put in the equal list. This lets you pass in sequences when you don't want all of the elements to be inserted into a stream.

References mysqlpp::equal_list().

◆ equal_list() [7/7]

template<class Seq1 , class Seq2 >
equal_list_ba<Seq1, Seq2, do_nothing_type0> mysqlpp::equal_list ( const Seq1 &  s1,
const Seq2 &  s2,
const char *  d = ",",
const char *  e = " = " 
)

Constructs an equal_list_ba.

This function returns an equal list that uses the 'do_nothing' manipulator. That is, the items are not quoted or escaped in any way when inserted into a stream. See equal_list(Seq, Seq, const char*, const char*, Manip) if you need a different manipulator.

The idea is for both lists to be of equal length because corresponding elements from each list are handled as pairs, but if one list is shorter than the other, the generated list will have that many elements.

Parameters
s1items on the left side of the equals sign when the equal list is inserted into a stream
s2items on the right side of the equals sign
ddelimiter operator<< should place between pairs
ewhat operator<< should place between items in each pair; by default, an equals sign, as that is the primary use for this mechanism.

References mysqlpp::do_nothing, and mysqlpp::equal_list().

Referenced by mysqlpp::equal_list().

◆ operator<<() [1/4]

template<class Seq1 , class Seq2 , class Manip >
std::ostream& mysqlpp::operator<< ( std::ostream &  o,
const equal_list_b< Seq1, Seq2, Manip > &  el 
)

Same as operator<< for equal_list_ba, plus the option to suppress insertion of some list items in the stream.

See equal_list_b's documentation for examples of how this works.

References mysqlpp::equal_list_b< Seq1, Seq2, Manip >::delim, mysqlpp::equal_list_b< Seq1, Seq2, Manip >::equl, mysqlpp::equal_list_b< Seq1, Seq2, Manip >::fields, mysqlpp::equal_list_b< Seq1, Seq2, Manip >::list1, mysqlpp::equal_list_b< Seq1, Seq2, Manip >::list2, and mysqlpp::equal_list_b< Seq1, Seq2, Manip >::manip.

◆ operator<<() [2/4]

template<class Seq1 , class Seq2 , class Manip >
std::ostream& mysqlpp::operator<< ( std::ostream &  o,
const equal_list_ba< Seq1, Seq2, Manip > &  el 
)

Inserts an equal_list_ba into an std::ostream.

Given two lists (a, b) and (c, d), a delimiter D, and an equals symbol E, this operator will insert "aEcDbEd" into the stream.

See equal_list_ba's documentation for concrete examples.

See also
equal_list()

References mysqlpp::equal_list_ba< Seq1, Seq2, Manip >::delim, mysqlpp::equal_list_ba< Seq1, Seq2, Manip >::equl, mysqlpp::equal_list_ba< Seq1, Seq2, Manip >::list1, mysqlpp::equal_list_ba< Seq1, Seq2, Manip >::list2, and mysqlpp::equal_list_ba< Seq1, Seq2, Manip >::manip.

◆ operator<<() [3/4]

template<class Seq , class Manip >
std::ostream& mysqlpp::operator<< ( std::ostream &  o,
const value_list_b< Seq, Manip > &  cl 
)

Same as operator<< for value_list_ba, plus the option to suppress insertion of some list items in the stream.

See value_list_b's documentation for examples of how this works.

References mysqlpp::value_list_b< Seq, Manip >::delim, mysqlpp::value_list_b< Seq, Manip >::fields, mysqlpp::value_list_b< Seq, Manip >::list, and mysqlpp::value_list_b< Seq, Manip >::manip.

◆ operator<<() [4/4]

template<class Seq , class Manip >
std::ostream& mysqlpp::operator<< ( std::ostream &  o,
const value_list_ba< Seq, Manip > &  cl 
)

Inserts a value_list_ba into an std::ostream.

Given a list (a, b) and a delimiter D, this operator will insert "aDb" into the stream.

See value_list_ba's documentation for concrete examples.

See also
value_list()

References mysqlpp::value_list_ba< Seq, Manip >::delim, mysqlpp::value_list_ba< Seq, Manip >::list, and mysqlpp::value_list_ba< Seq, Manip >::manip.

◆ value_list() [1/6]

template<class Seq >
value_list_b<Seq, do_nothing_type0> mysqlpp::value_list ( const Seq &  s,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a sparse value list.

Same as value_list(Seq&, const char*, Manip, bool, bool...) but without the Manip or delimiter parameters. We use the do_nothing manipulator, meaning that the value list items are neither escaped nor quoted when being inserted into a stream. The delimiter is a comma. This form is suitable for lists of simple data, such as integers.

References mysqlpp::do_nothing, and mysqlpp::value_list().

◆ value_list() [2/6]

template<class Seq >
value_list_b<Seq, do_nothing_type0> mysqlpp::value_list ( const Seq &  s,
const char *  d,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a sparse value list.

Same as value_list(Seq&, const char*, Manip, bool, bool...) but without the Manip parameter. We use the do_nothing manipulator, meaning that the value list items are neither escaped nor quoted when being inserted into a stream.

References mysqlpp::do_nothing, and mysqlpp::value_list().

◆ value_list() [3/6]

template<class Seq , class Manip >
value_list_ba<Seq, Manip> mysqlpp::value_list ( const Seq &  s,
const char *  d,
Manip  m 
)

Constructs a value_list_ba.

Parameters
san STL sequence of items in the value list
ddelimiter operator<< should place between items
mmanipulator to use when inserting items into a stream

References mysqlpp::value_list().

◆ value_list() [4/6]

template<class Seq , class Manip >
value_list_b<Seq, Manip> mysqlpp::value_list ( const Seq &  s,
const char *  d,
Manip  m,
bool  t0,
bool  t1 = false,
bool  t2 = false,
bool  t3 = false,
bool  t4 = false,
bool  t5 = false,
bool  t6 = false,
bool  t7 = false,
bool  t8 = false,
bool  t9 = false,
bool  ta = false,
bool  tb = false,
bool  tc = false 
)

Constructs a value_list_b (sparse value list)

Same as value_list(Seq&, const char*, Manip, const vector<bool>&), except that it takes the bools as arguments instead of wrapped up in a vector object.

References mysqlpp::value_list().

◆ value_list() [5/6]

template<class Seq , class Manip >
value_list_b<Seq, Manip> mysqlpp::value_list ( const Seq &  s,
const char *  d,
Manip  m,
const std::vector< bool > &  vb 
)
inline

Constructs a value_list_b (sparse value list)

Parameters
san STL sequence of items in the value list
ddelimiter operator<< should place between items
mmanipulator to use when inserting items into a stream
vbfor each item in this vector that is true, the corresponding item in the value list is inserted into a stream; the others are suppressed

References mysqlpp::value_list().

◆ value_list() [6/6]

template<class Seq >
value_list_ba<Seq, do_nothing_type0> mysqlpp::value_list ( const Seq &  s,
const char *  d = "," 
)

Constructs a value_list_ba.

This function returns a value list that uses the 'do_nothing' manipulator. That is, the items are not quoted or escaped in any way. See value_list(Seq, const char*, Manip) if you need to specify a manipulator.

Parameters
san STL sequence of items in the value list
ddelimiter operator<< should place between items

References mysqlpp::do_nothing, and mysqlpp::value_list().

Referenced by mysqlpp::value_list().