Next: 6. Template Queries
Up: Usage
Previous: 4. Tutorial by Example
  Contents
Subsections
This chapter documents all of the classes that are meant to be used. If it is
not documented here don't use it because it is a internal method or
class meant to only be used by other related classes.
5.1 BadConversion
struct BadConversion
Related to: mysql_ColData (5.29)
Exception structure thrown when a bad conversion takes place
Public members:
- const char* type_name
- const string data
- size_t retrieved
- size_t actual_size
5.2 BadNullConversion
class BadNullConversion
Related to: Null (5.12)
Thrown when a Null value is trying to be converted into a type it can't convert to.
5.3 Connection
class Connection
The main database handle
Public members:
- Connection ()
- bool connected () const - returns true if a successful connection was made
- bool success () - returns true of the last query was successful
- bool connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "")
- void purge (MYSQL *m)
- inline Query query ()
- operator bool () - returns success()
- string error () - last error message()
- string clinet_info ()
- string host_info ()
- int proto_info ()
- string server_info ()
- string stat ()
- Result store (const string &str)
- ResUse use (const string &str)
- ResNSel execute (const string &str)
- Result store (const string &str, bool te)
- ResUse use (const string &str, bool te)
- ResNSel execute (const string &str, bool te)
- bool create_db (string db)
- bool drop_db (string db)
- bool select_db (string db)
- bool select_db (const char *db)
- bool reload ()
- bool shutdown ()
- template <class Sequence> void storein_sequence (Sequence &, const string &)
- template <class Set> void storein_set (Set &, const string &)
- void storein (TYPE &con, const string &s) (5.3.2) - Stores the results in TYPE.
Related Types
- typedef Connection Mysql - For backwards companablity, don't use
5.3.2 storein(TYPE &con, const string &s)
void storein (TYPE &con, const string &s)
Stores the results in TYPE.
Stores the result in TYPE. TYPE must be some sort of STL container.
5.4 Date
struct Date
A special type for holding mysql Dates.
Date, a comparable data structures for holding mysql Dates. It also
responds to the stream extraction and insertion operator.
Public members:
- short int year - The year in 4 digit form
- tiny_int month - The month number
- tiny_int day - The day of the month
- Date ()
- Date (cchar* str)
- Date (const ColData &str)
- Date (const string &str)
- short int compare (const Date& other) const
5.5 DateTime
struct DateTime
A combinate of Date and Time for holding mysql DateTime's
5.6 FieldNames
class FieldNames
Parents: public vector<string>
A vector of the field names.
Public members:
- FieldNames& operator = (const ResUse *res) - Creates a new list from the data in res.
- FieldNames& operator = (int i) - Creates a new list with i field names.
- string& operator [] (int i) - returns the field name of the field with that index number
- const string& operator [] (int i) const - returns the field name of the field with that index number
- uint operator [] (string i) const
5.7 FieldTypes
class FieldTypes
Parents: public vector<mysql_type_info>
A vector of the field types.
Public members:
- FieldTypes& operator = (const ResUse *res) - Creates a new list based on the info in res
- FieldTypes& operator = (int i) - Creates a new list with i fields.
- mysql_type_info& operator [] (int i) - Returns the field type for the field with an offset of i.
- const mysql_type_info& operator [] (int i) const
5.8 Fields
class Fields
Parents: public const_subscript_container<Fields, Field>
A vector like container with the raw mysql field info.
Public members:
- size_type size () const - the number of fields. Returns the field with an offset of i;
5.9 MutableRes
class MutableRes
Parents: public vector<MutableRow<MutableRes> >
This class handles the result set.
It is also a Random Access Container that is not LessThanComparable
but is Assignable. Being a Random Access Container it can
return a Random Access Iterator or a reverse Random Access Iterator
yet.
Public members:
- MutableRes ()
- MutableRes (ResUse res)
- MutableRes (size_type i) - Creates a new mutable result set with i columns.
- MutableRes& operator = (ResUse res)
- MutableRes& operator = (size_type i)
- size_type rows () const - Returns the number of rows.
- size_type columns () const - Returns the number of columns.
- inline int field_num (const string& str) const - Returns the offset of the filed which equals str.
- inline string& field_name (int i) - Returns the field with an offset of i.
- inline const string& field_name (int i) const - Returns the field with an offset of i.
- inline FieldNames& field_names () - Returns a reference to the underlying FieldNames class.
- inline const FieldNames& field_names () const (5.9.2) - Returns a const reference to the underlying FieldNames class.
- inline int names (const string& s) const - Returns the offset of the filed which equals str.
- inline string& names (int i) - Returns the field with an offset of i.
- inline const string& names (int i) const - Returns the field with an offset of i.
- inline FieldNames& names () - Returns a reference to the underlying FieldNames class.
- inline const FieldNames& names () const
5.9.2 field_names() const
inline const FieldNames& field_names () const
Returns a const reference to the underlying FieldNames class.
short names for the above methods
5.10 MutableRow
template class MutableRow<class Res = ResUse>
Parents: public MutableRow_base<Res>
Related Classes
- template class MutableRow_base<class Res> (
) - This class handles the actual rows with the added benefit of being able to modify the data.
5.11 MutableRow_base
template class MutableRow_base<class Res>
Parents: public vector<MutableColData>, public RowTemplate<MutableRow_base<Res>, Res>
Related to: MutableRow (5.10)
This class handles the actual rows with the added benefit of being able to modify the data.
Public members:
- MutableColData& operator [] (int i) - Returns the value of the field with the index of i.
- const MutableColData& operator [] (int i) const - Returns the value of the field with the index of i.
- MutableColData& operator [] (const string &i) (5.11.2) - Returns the value of the field with the field name of i.
- const MutableColData& operator [] (const string &i) const (5.11.3) - Returns the value of the field with the field name of i.
- operator bool ()
5.11.2 operator [](const string &i)
MutableColData& operator [] (const string &i)
Returns the value of the field with the field name of i.
This method is not nearly as efficient as using the index number. Use sparingly.
5.11.3 operator [](const string &i) const
const MutableColData& operator [] (const string &i) const
Returns the value of the field with the field name of i.
This method is not nearly as efficient as using the index number. Use sparingly.
5.12 Null
template class Null<class Type, class Behavior = NullisNull>
Container class for holding null types.
Public members:
- Null ()
- Null (Type x)
- Null (const null_type &n) (5.12.2) - Gives Null the null value
- operator Type& ()
- Null& operator = (const Type &x)
- Null& operator = (const null_type &n)
Related Types
- typedef void value_type - OEP - Specialization for <void> Gives Null the null value
Related Classes
- class BadNullConversion (5.2) - Thrown when a Null value is trying to be converted into a type it can't convert to.
- struct NullisBlank (5.13) - Type to use for the behavior parameter for Null<>
- struct NullisNull (5.14) - Type to use for the behavior parameter for Null<>
- struct NullisZero (5.15) - Type to use for the behavior parameter for Null<>
5.12.2 Null(const null_type &n)
Null (const null_type &n)
Gives Null the null value
Note: the global const null (not NULL) is of value null_type thus
you can say something like Null<Type> x = null.
5.13 NullisBlank
struct NullisBlank
Related to: Null (5.12)
Type to use for the behavior parameter for Null<>
5.14 NullisNull
struct NullisNull
Related to: Null (5.12)
Type to use for the behavior parameter for Null<>
5.15 NullisZero
struct NullisZero
Related to: Null (5.12)
Type to use for the behavior parameter for Null<>
5.16 Query
class Query
Parents: public SQLQuery
A Query class suitable for executing queries.
This is the class is subclassed from SQLQuery. This class unlike
SQLQuery is loosely attached to a Mysql object so that it can
execute queries.
Public members:
- Query (Connection *m, bool te = false) - Create a new query object attached to a connection.
- Query (const Query &q)
- Query& operator = (const Query &q)
- string error () - The error message if the query was not successful.
- bool success () (5.16.2) - Displays the string currently in the buffer.
- string preview ()
- string preview (parms &p)
- MysqlResNSel execute (...) (5.16.3) - Executes the query in the string buffer.
- MysqlRes store (...) (5.16.4) - Executes the query in the string buffer.
- MysqlResUse use (...) (5.16.5) - Executes the query in the string buffer.
Related Classes
- class SQLQuery (5.21) - The "pure" query class
5.16.2 success()
bool success ()
Displays the string currently in the buffer.
Same thing as string().
5.16.3 execute(...)
MysqlResNSel execute (...)
Executes the query in the string buffer.
Executes the query in the string buffer and returns a structure
that contains the information of the success of the query. Use
this for queries that don't return a result set such as INSERT,
UPDATE, etc.
The parameters can be anything in a valid SQLQuery::str.
5.16.4 store(...)
MysqlRes store (...)
Executes the query in the string buffer.
Executes a query in the string buffer and returns the result.
The parameters can be anything in a valid SQLQuery::str.
5.16.5 use(...)
MysqlResUse use (...)
Executes the query in the string buffer.
Executes the query in the string buffer and returns the
results. This method used the mysql_use_result(MYSQL_RES)
function and thus should be used sparingly. Also the Result set is
a lot more limited and DOES NOT have an iterator.
The parameters can be anything in a valid SQLQuery::str.
5.17 ResNSel
struct ResNSel
Related to: Result (5.19)
This structure holds the information on the success of queries thatdon't return any results.
Public members:
- int insert_id
- int rows - Number of rows affected
- string info - Additional info
- operator bool ()
5.18 ResUse
class ResUse
Public members:
- Row fetch_row () - raw c api function
- bool eof () const - raw c api function
- long unsigned int * fetch_lengths () const - raw c api function
- void free_result () - raw c api function
- Field& fetch_field () const - raw c api field function
- void field_seek (int field) - raw c api field function
- int num_fields () const - raw c api field function
- operator bool ()
- unsigned int columns () const
- string& table () - table name
- const string& table () const - table name
- inline int field_num (const string&) const - Returns the offset of the filed which equals str.
- inline string& field_name (int) - Returns the field with an offset of i.
- inline const string& field_name (int) const - Returns the field with an offset of i.
- inline FieldNames& field_names () - Returns a reference to the underlying FieldNames class.
- inline const FieldNames& field_names () const - Returns a const reference to the underlaying FieldNames class.
- inline void reset_field_names () - Resets the field names to there original values.
- inline mysql_type_info& field_type (int i) - Returns a reference to the mysql field type for the field with an offset of i.
- inline const mysql_type_info& field_type (int) const - Returns a const reference to the mysql field type for the field with an offset of i.
- inline FieldTypes& field_types () - Returns a reference to the underlying FieldTypes
- inline const FieldTypes& field_types () const - Returns a const reference to the underlying FieldTypes
- inline void reset_field_types () - Resets the field_types to their original values.
- inline int names (const string& s) const - Returns the offset of the filed which equals str.
- inline string& names (int i) - Returns the field with an offset of i.
- inline const string& names (int i) const - Returns the field with an offset of i.
- inline FieldNames& names () - Returns a reference to the underlying FieldNames class.
- inline const FieldNames& names () const - Returns a const reference to the underlying FieldNames class.
- inline void reset_names () - Resets the field names to their original values.
- inline mysql_type_info& types (int i) - Returns a reference to the mysql field type for the field with an offset of i.
- inline const mysql_type_info& types (int i) const - Returns a const reference to the mysql field type for the field with an offset of i.
- inline FieldTypes& types () - Returns a reference to the underlying FieldTypes
- inline const FieldTypes& types () const - Returns a const reference to the underlying FieldTypes
- inline void reset_types () - Resets the field_types to their original values.
- const Fields& fields () const - returns a reference to the underling Fields structure.
- const Field& fields (unsigned int i) const - returns a reference to the the mysql field info for a field with an offset of i.
- bool operator == (const ResUse &other) const
- bool operator != (const ResUse &other) const
5.19 Result
class Result
Parents: public ResUse, public const_subscript_container<Result,Row,const Row>
This class handles the result set.
It is also a Random Access Container that is not LessThanComparable
and not Assignable. Being a Random Access Container it can
return a Random Access Iterator or a reverse Random Access Iterator
yet.
See MutableRes for a result set that can be modified.
Public members:
- Result ()
- Result (MYSQL_RES *result, bool te = false)
- Result (const Result &other) (5.19.2)
- const Row fetch_row () const - Raw c api function
- int num_rows () const - Raw c api function
- void data_seek (uint offset) const - Raw c api function
- size_type size () const - Returns the number of columns.
- size_type rows () const - Returns the number of rows.
- const Row operator [] (size_type i) const
Related Functions
- inline void swap (Result &x, Result &y)
Related Classes
- struct ResNSel (5.17) - This structure holds the information on the success of queries thatdon't return any results.
5.19.2 Result(const Result &other)
Result (const Result &other)
raw mysql c api functions
5.20 Row
class Row
Parents: public const_subscript_container<Row,ColData,const ColData>, public RowTemplate<Row, ResUse>
This class handles the actual rows in an intelligent manner.
MYSQL_ROW data;
Public members:
- inline size_type size () const - Returns the number of columns.
- inline const ColData operator [] (size_type i) const - Returns the value of the field with the index of i.
- inline const ColData operator [] (const char *) const (5.20.2) - Returns the value of the field with the field name of i.
- inline const ColData operator [] (const string &i) const (5.20.3) - Returns the value of the field with the field name of i.
- operator bool () - Returns true if there is data in the row.
5.20.2 operator [](const char *) const
inline const ColData operator [] (const char *) const
Returns the value of the field with the field name of i.
This method is not nearly as efficient as using the index number. Use sparingly.
5.20.3 operator [](const string &i) const
inline const ColData operator [] (const string &i) const
Returns the value of the field with the field name of i.
This method is not nearly as effecent as using the index number. Use sparingly.
5.21 SQLQuery
class SQLQuery
Parents: public strstream
Related to: Query (5.16)
The "pure" query class
This is the "pure" query class. It is used to form queries to send
to the Connection object. The Query class can be used if you
wish to also be able to execute the queries without having to send
them to the Connection object.
This class is subclassed from strstream. This means that you can
write to it like a stream to avoid having to piece parts together
by creating you own strstream or by using sprintf. Although you
can read from query because it is a stream this is not
recommended. I can not guarantee the predictability of the class if
you do and will offer no help if you run into problems when you do
this. However, fell free to use any of the stream methods to write
to it. Just make sure that the write buffer points to the end of
your query before you try to use any of the SQLQuery specific
methods except for error() and success().
Public members:
- SQLQuery ()
- SQLQuery (const SQLQuery &q)
- SQLQuery& operator = (const SQLQuery &q)
- SQLQueryParms def - The default template parameters set.
- string str (query_reset r = DONT_RESET) (5.21.2) - Returns the full query string.
- string str (const SQLString &parm0, ...,const SQLString &parm11) (5.21.3) - Like str(query_reset) but sets the parameters.
- string str (const SQLQueryParms & p, query_reset r = DONT_RESET) (5.21.4) - Like str(query_reset) but sets the parameter.
- void reset () (5.21.5) - Resets the query.
- template <class T> SQLQuery& update (const T &o, const T &n)
- template <class T> SQLQuery& insert (const T &v)
- template <class T> SQLQuery& replace (const T &v)
Related Classes
- struct SQLQueryNEParms (5.22) - Exception thrown when not enough parameters are provided
- class SQLQueryParms (5.23) - This class holds the parameter values for filling template queries.
5.21.2 str(query_reset r = DONT_RESET)
string str (query_reset r = DONT_RESET)
Returns the full query string.
Returns the full query string, replacing it with the default
template parameters if necessary. query_reset can either be
DONT_RESET or RESET_QUERY. If it is set the RESET_QUERY then
reset() is called after it has finished returning the query. If
there is not enough parameters then it will return a
empty string and success() would be false.
5.21.3 str(const SQLString &parm0, ...,const SQLString &parm11)
string str (const SQLString &parm0, ...,const SQLString &parm11)
Like str(query_reset) but sets the parameters.
Like str(query_reset) but sets query parameters 0 to (up to)
11. To parm0, parm1 etc. This is archived by overloaded methods
and templates and not the ...
It will combine this with def. If any of the required parameters
are null it will produce an error and return an empty string.
5.21.4 str(const SQLQueryParms & p, query_reset r = DONT_RESET)
string str (const SQLQueryParms & p, query_reset r = DONT_RESET)
Like str(query_reset) but sets the parameter.
Like query(query_reset res) but sets the parameters based on
combining p and def.
If any of the required parameters are null it will produce an
error and return an empty string.
5.21.5 reset()
void reset ()
Resets the query.
This means erasing the string and the default template parameters.
5.22 SQLQueryNEParms
struct SQLQueryNEParms
Related to: SQLQuery (5.21)
Exception thrown when not enough parameters are provided
Thrown when not enough parameters are provided for a
template query.
Public members:
5.23 SQLQueryParms
class SQLQueryParms
Parents: public vector<SQLString>
Related to: SQLQuery (5.21)
This class holds the parameter values for filling template queries.
It is a subclass of a vector of SQLStrings.
Public members:
- void clear () - Clears the list
- SQLString & operator [] (size_type n) - Access element number n
- const SQLString & operator [] (size_type n) const - Access element number n
- SQLString & operator [] (const char *str) - Access the value of the element with a key of str.
- const SQLString & operator [] (const char *str) const - Access the value of the element with a key of str.
- SQLQueryParms & operator << (const SQLString &str) - Adds an element to the list
- SQLQueryParms & operator += (const SQLString &str) - Adds an element to the list
- void set (ss a, [ss b] ,... , [ss l]) (5.23.2) - Set the elements.
5.23.2 set(ss a, [ss b] ,... , [ss l])
void set (ss a, [ss b] ,... , [ss l])
Set the elements.
Sets element 0 to a, element 1 to b, etc. May specify up to a dozen elements
5.24 SQLString
class SQLString
Parents: public string
A special string that will convert from anything.
A class subclassed from string that has the additional ability to
convert from any valid mysql type.
5.25 Set
template class Set<class Container = set<string> >
Parents: public Container
A Special Set for holding mysql sets.
Public members:
- Set (const char* str)
- Set (const string &str)
- Set (const ColData &str)
Related Functions
- template <class Container> inline ostream& operator << (ostream &s, const Set<Container> &d)
5.26 Time
struct Time
A special type for holding mysql Dates.
Time, a comparable data structures for holding mysql Times. It also
responds to the stream extraction and insertion operator.
Public members:
- tiny_int hour - Hour in military time
- tiny_int minute
- tiny_int second
- Time ()
- Time (cchar* str)
- Time (const ColData &str)
- Time (const string &str)
- short int compare (const Time& other) const
5.27 const_string
class const_string
A special string that is created from a existing const char *
It contains a small subset of the standard string class. When an
object is created only a link to the const char * is created. The
data is NOT copied. thus the const char * needs to stick around
for the life of the class.
Public members:
- typedef const char value_type
- typedef unsigned int size_type
- typedef int difference_type
- typedef const char& const_reference
- typedef const_reference reference
- typedef const char* const_pointer
- typedef const_pointer pointer
- typedef const char* const_iterator
- typedef const_iterator iterator - The same as const_iterator because the data can not be changed.
- const_string ()
- const_string (const char *str)
- const_iterator begin () const
- const_iterator end () const
- size_type length () const
- size_type max_size () const
- const_reference operator[] (size_type pos) const
- const char* c_str () const
- const char* data () const
Related Functions
- inline ostream& operator << (ostream &o, const const_string &str)
- inline int compare (const const_string &lhs, const const_string &rhs)
- inline bool operator == (const_string &lhs, const_string &rhs)
- inline bool operator != (const_string &lhs, const_string &rhs)
- inline bool operator < (const_string &lhs, const_string &rhs)
- inline bool operator <= (const_string &lhs, const_string &rhs)
- inline bool operator > (const_string &lhs, const_string &rhs)
- inline bool operator >= (const_string &lhs, const_string &rhs)
5.28 const_subscript_container
template class const_subscript_container<class OnType, class ValueType, class ReturnType = const ValueType&, class SizeType = unsigned int, class DiffType = int>
A container adapter to make a container into a Random Access Container.
The requirements are that the container has the member functions
operator[] (SizeType) and size() defined.
Public members:
- typedef const_subscript_container<OnType,ValueType,ReturnType,SizeType,DiffType> this_type
- typedef subscript_iterator<const this_type, ReturnType, SizeType, DiffType> iterator
- typedef iterator const_iterator
- typedef const ::reverse_iterator<iterator> reverse_iterator
- typedef const ::reverse_iterator<const_iterator> const_reverse_iterator
- typedef ValueType value_type
- typedef value_type& reference
- typedef value_type& const_reference
- typedef value_type* pointer
- typedef value_type* const_pointer
- typedef DiffType difference_type
- typedef SizeType size_type
- pure virtual size_type size () const
- pure virtual ReturnType operator[] (SizeType i) const
- size_type max_size () const
- bool empty () const
- iterator begin () const
- iterator end () const
- reverse_iterator rbegin () const
- reverse_iterator rend () const
5.29 mysql_ColData
template class mysql_ColData<class Str>
Parents: public Str
Base class for auto-converting column data. Do not use directly.
A smart string. It will automatically convert it self to any of the
basic C types.
When used with binary operators it will
automatically convert it self to the type used on the other side of
the operator if it is a basic type.
However, be careful when using it with binary operators as.
MysqlStr("12.86") + 2
will return 14 because 2 is an integer. What you wanted to say was
MysqlStr("12.86") + 2.0
If this type of thing scares you define the micro NO_BINARY_OPERS
to turn of this behavior.
This class also has some basic information about the type of data
stored in it.
<bf>Do not use this class directly.</bf>
Use the typedef ColData or MutableColData instead.
Public members:
- mysql_type_info type () - Returns the current mysql type of current item
- bool quote_q () const - Returns true or false depending on if the data is of a type that should be quoted
- bool escape_q () const - Returns true of false depending on if the data is of a type that should be escaped
- operator TYPE () (5.29.2) - Converts the column data to TYPE.
Related Types
- typedef mysql_ColData<const_string> ColData - The Type that is returned by constant rows
- typedef mysql_ColData<string> MutableColData - The Type that is returned by mutable rows
- typedef ColData MysqlString - For backwards compatibility. Do not use.
- typedef ColData MysqlStr - For backwards compatibility. Do not use.
Related Classes
- struct BadConversion (5.1) - Exception structure thrown when a bad conversion takes place
5.29.2 operator TYPE()
operator TYPE ()
Converts the column data to TYPE.
If all the charters are not read during the conversion to TYPE it
will through BadConversion.
TYPE is defined for all the build in types.
(Note, This is not an actual template)
5.30 mysql_type_info
class mysql_type_info
Class that holds basic type information for ColData.
Public members:
- static const unsigned char string_type - The id of the string type.
- mysql_type_info ()
- mysql_type_info (unsigned char n)
- inline mysql_type_info (enum_field_types t, bool _unsigned, bool _null)
- inline mysql_type_info (const MYSQL_FIELD &f)
- mysql_type_info (const mysql_type_info &t)
- mysql_type_info (const type_info &t)
- mysql_type_info& operator = (unsigned char n)
- mysql_type_info& operator = (const mysql_type_info &t)
- mysql_type_info& operator = (const type_info &t)
- inline const char* name () const (5.30.2) - Returns a implication defined name of the c++ type.
- inline const char* sql_name () const - Returns the name for the sql type.
- inline const unsigned int max_length () const - Returns the type_info for the C++ type associated with the sql type.
- inline const mysql_type_info base_type () const (5.30.3) - Returns the type_info for the C++ type inside of the Null type.
- int id () const (5.30.4) - Returns the id of the sql_type.
- bool quote_q () const - Returns true if the sql type is of a type that needs to be quoted.
- bool escape_q () const - Returns true if the sql type is of a type that needs to be escaped.
- bool before (mysql_type_info &b)
5.30.2 name() const
inline const char* name () const
Returns a implication defined name of the c++ type.
Returns the name that would be returned by typeid().name() for the C++ type
associated with the sql type.
5.30.3 base_type() const
inline const mysql_type_info base_type () const
Returns the type_info for the C++ type inside of the Null type.
If the type is not null then this is the same as c_type()
5.30.4 id() const
int id () const
Returns the id of the sql_type.
Note: Do not ever use this id directly as it may change between versions.
5.31 subscript_iterator
template class subscript_iterator<class OnType, class ReturnType, class SizeType, class DiffType>
Parents: public random_access_iterator<ReturnType, SizeType>
Functions:
- template <class BinaryPred, class CmpType> MysqlCmp <BinaryPred, CmpType> mysql_cmp (uint i, const BinaryPred &func, const CmpType &cmp2) - A special function for using in find_if function where i is the field index number.
- template <class BinaryPred> MysqlCmpCStr <BinaryPred> mysql_cmp_cstr (uint i, const BinaryPred &func, const char *cmp2) - A special function for using in find_if fucntion where i is the field indexnumber.
template <class BinaryPred, class CmpType> MysqlCmp <BinaryPred, CmpType> mysql_cmp (uint i, const BinaryPred &func, const CmpType &cmp2)
A special function for using in find_if function where i is the field index number.
This is a more generic form of mysql_cmp_cstr will work with any
CmpType that MysqlString can convert to. However, this is not
neary as effecent. Only use when obsoletely nessary.
template <class BinaryPred> MysqlCmpCStr <BinaryPred> mysql_cmp_cstr (uint i, const BinaryPred &func, const char *cmp2)
A special function for using in find_if fucntion where i is the field indexnumber.
func should be one of cstr_equal_to(), cstr_not_equal_to(),
cstr_less(), cstr_less_equal(), cstr_less_equal(), cstr_less_equal().
5.33 Manipulators
The following manipulators modify only the next item to the right of it in an
<< chain. They can be used with any ostream (which
includes SQLQuery and Query because they are also ostreams)
or SQLQueryParms. When used with SQLQueryParms they will override
any settings set by the Template Query for that particular item.
- quote
- Quote and escape the next item. Can be used with ostream or
SQLQueryParms.
- quote_only
- Quote but don't escape the next item. Can be used with ostream
or SQLQueryParms.
- quote_only_double
- Quote, but don't escape the next item, with `` instead
of '.
- escape
- Escape the next item.
- do_nothing
- Does exactly what it says nothing. Used as a dummy manipulator
when you are required to use some manipulator. When used with SQLQueryParms
it will make sure that it does not get formatted in any way overriding any setting
set by the template query.
- ignore
- Only valid when used with SQLQueryParms. Like do_nothing
however this one will not override formatting set by the template query, thus
it is ignored.
Since version 1.6, automatic quoting and escaping has been added to manipulators.
This mechanism is applied to mysql_ColData only, iso epse to the class very
frequentrly uitlized as a return object of Row[] index. Automatic quoting
or escaping is used with << operator only,
and on all stream derived classes and objects, including strstream, query objects,
but excepting cout, cerr and clog. This has been designed so intentionally,
as streaming out values to those objects does not require quoting or escaping.
But this feature comes handy when you construct query's by streaming values
to query object or to strstream class object.
This feature can be glibally turned of by setting value dont_quote_auto
in your code to true.
Next: 6. Template Queries
Up: Usage
Previous: 4. Tutorial by Example
  Contents
2000-05-16