Next: 6. Template Queries
Up: Usage
Previous: 4. Tutorial by Example
  Contents
Subsections
- 5.1 struct BadConversion
- 5.2 class BadNullConversion
- 5.3 class Connection
- Type
- Include file
- Synopsis
- Public methods
- public Connection ()
- public Connection (bool te)
- public Connection (const char *db, const char *host = "", const char *user = "", const char *passwd = "", bool te = true)
- public Connection (const char *db, const char *host, const char *user, const char *passwd, uint port, my_bool compress = 1, unsigned int connect_timeout = 5, bool te = true, cchar *socket_name = "")
- public int affected_rows ()
- public operator bool ()
- public string clinet_info ()
- public void close ()
- public bool connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "")
- public bool connected () const
- public bool create_db (string db)
- public bool drop_db (string db)
- public int errnum ()
- public string error ()
- public bool exec (const string &str)
- public ResNSel execute (const string &str)
- public ResNSel execute (const string &str, bool te)
- public st_mysql_options get_options (void) const
- public string host_info ()
- public string info ()
- public string infoo (void)
- public int insert_id ()
- public int kill (unsigned long pid)
- public bool lock ()
- public int ping (void)
- public int proto_info ()
- public void purge (void)
- public inline Query query ()
- public int read_options (enum mysql_option option,const char *arg)
- public bool real_connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "", uint port = 0, my_bool compress = 0, unsigned int connect_timeout = 60, cchar *socket_name= "")
- public int refresh (unsigned int refresh_options)
- public bool reload ()
- public bool select_db (const char *db)
- public bool select_db (string db)
- public string server_info ()
- public bool shutdown ()
- public string stat ()
- public Result store (const string &str)
- public Result store (const string &str, bool te)
- public template class T void storein (dequeT &con, const string &s)
- public template class T void storein (listT &con, const string &s)
- public template class T void storein (multisetT &con, const string &s)
- public template class T void storein (setT &con, const string &s)
- public template class T void storein (slistT &con, const string &s)
- public template class T void storein (vectorT &con, const string &s)
- public template class Sequence void storein_sequence (Sequence &, const string &)
- public template class Set void storein_set (Set &, const string &)
- public bool success ()
- public void unlock ()
- public ResUse use (const string &str)
- public ResUse use (const string &str, bool te)
- public ~ Connection ()
- Friend methods
- 5.4 struct Date
- 5.5 struct DateTime
- 5.6 class FieldNames
- 5.7 class FieldTypes
- 5.8 class Fields
- 5.9 template class MysqlCmp class BinaryPred, class CmpType
- 5.10 template class MysqlCmpCStr class BinaryPred
- 5.11 template struct MysqlDTbase class T
- 5.12 template class MysqlListInsert class T, class value_type = typename T::value_type
- 5.13 template class MysqlSetInsert class T, class key_type = typename T::key_type
- 5.14 template class Null class Type, class Behavior = NullisNull
- 5.15 struct NullisBlank
- 5.16 struct NullisNull
- 5.17 struct NullisZero
- 5.18 class Query
- 5.19 struct ResNSel
- 5.20 class ResUse
- 5.21 class Result
- 5.22 class Row
- 5.23 template class RowTemplate class ThisType, class Res
- Type
- Include file
- Synopsis
- Public methods
- public equal_list_baFieldNames,ThisType,quote_type0 equal_list (const char *d = ",", const char *e = " = ") const
- public template class Manip equal_list_baFieldNames,ThisType,Manip equal_list (const char *d, const char *e, Manip m) const
- public value_list_bFieldNames,quote_type0 field_list (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) const
- public value_list_bFieldNames,quote_type0 field_list (const vectorbool &vb) const
- public value_list_bFieldNames,quote_type0 field_list (const vectorbool &vb) const
- public template class Manip value_list_baFieldNames,Manip field_list (const char *d, Manip m) const
- public template class Manip value_list_bFieldNames,Manip field_list (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) const
- public template class Manip value_list_bFieldNames,Manip field_list (const char *d, Manip m, const vectorbool &vb) const
- public template class Manip value_list_bFieldNames,Manip field_list (const char *d, Manip m, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public value_list_bFieldNames,quote_type0 field_list (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) const
- public value_list_bFieldNames,quote_type0 field_list (const char *d, const vectorbool &vb) const
- public value_list_bFieldNames,quote_type0 field_list (const char *d, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public value_list_bFieldNames,quote_type0 field_list (string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public pure virtual const Res & parent () const
- public value_list_bThisType,quote_type0 value_list (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) const
- public value_list_bThisType,quote_type0 value_list (const vectorbool &vb) const
- public value_list_bThisType,quote_type0 value_list (const vectorbool &vb) const
- public template class Manip value_list_baThisType,Manip value_list (const char *d, Manip m) const
- public template class Manip value_list_bThisType,Manip value_list (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) const
- public template class Manip value_list_bThisType,Manip value_list (const char *d, Manip m, const vectorbool &vb) const
- public template class Manip value_list_bThisType,Manip value_list (const char *d, Manip m, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public value_list_bThisType,quote_type0 value_list (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) const
- public value_list_bThisType,quote_type0 value_list (const char *d, const vectorbool &vb) const
- public value_list_bThisType,quote_type0 value_list (const char *d, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public value_list_bThisType,quote_type0 value_list (string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- public virtual ~ RowTemplate ()
- Protected methods
- 5.24 struct SQLParseElement
- 5.25 class SQLQuery
- 5.26 struct SQLQueryNEParms
- 5.27 class SQLQueryParms
- Type
- Superclasses
- Include file
- Detailed description
- Synopsis
- Public methods
- public SQLQueryParms ()
- public SQLQueryParms (SQLQuery *p)
- public bool bound ()
- public void clear ()
- public SQLQueryParms operator + (const SQLQueryParms &other) const
- public SQLQueryParms &operator += (const SQLString &str)
- public SQLQueryParms &operator (const SQLString &str)
- public SQLString &operator (const char *str)
- public const SQLString &operator (const char *str) const
- public SQLString &operator (size_type n)
- public const SQLString &operator (size_type n) const
- public void set (ss a)
- public void set (ss a, ss b)
- public void set (ss a, ss b, ss c)
- public void set (ss a, ss b, ss c, ss d)
- public void set (ss a, ss b, ss c, ss d, ss e)
- public void set (ss a, ss b, ss c, ss d, ss e, ss f)
- public void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g)
- public void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h)
- public void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h, ss i)
- public void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j)
- public void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j,ss k)
- public void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j,ss k,ss l)
- Friend methods
- 5.28 class SQLString
- 5.29 template class Set class Container = setstring
- 5.30 struct Time
- 5.31 class const_string
- 5.32 template class const_subscript_container class OnType, class ValueType, class ReturnType = const ValueType&, class SizeType = unsigned int, class DiffType = int
- 5.33 struct cstr_equal_to
- 5.34 struct cstr_greater
- 5.35 struct cstr_greater_equal
- 5.36 struct cstr_less
- 5.37 struct cstr_less_equal
- 5.38 struct cstr_not_equal_to
- 5.39 struct do_nothing_type1
- 5.40 struct do_nothing_type2
- 5.41 template struct equal_list_b class Seq1, class Seq2, class Manip
- 5.42 template struct equal_list_ba class Seq1, class Seq2, class Manip
- 5.43 struct escape_type1
- 5.44 struct escape_type2
- 5.45 struct ignore_type2
- 5.46 template class mysql_ColData class Str
- 5.47 class mysql_convert
- 5.48 struct mysql_date
- 5.49 struct mysql_dt_base
- 5.50 class mysql_ti_sql_type_info
- 5.51 class mysql_ti_sql_type_info_lookup
- 5.52 struct mysql_time
- 5.53 class mysql_type_info
- 5.54 class null_type
- 5.55 struct quote_double_only_type1
- 5.56 struct quote_double_only_type2
- 5.57 struct quote_only_type1
- 5.58 struct quote_only_type2
- 5.59 struct quote_type1
- 5.60 struct quote_type2
- 5.61 template class simp_list_b class Iter
- 5.62 template class subscript_iterator class OnType, class ReturnType, class SizeType, class DiffType
- 5.63 struct type_info_cmp
- 5.64 template struct value_list_b class Seq, class Manip
- 5.65 template struct value_list_ba class Seq, class Manip
- 5.66 Manipulators
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.
Exception structure thrown when a bad conversion takes place
instantiable
coldata1.hh
- BadConversion (const char* tn, const char* d, size_t r, size_t a)
- size_t actual_size
- const string data
- size_t retrieved
- const char* type_name
Thrown when a *Null* value is trying to be converted into a type it can't convert to.
instantiable
null1.hh
The main database handle
instantiable
connection1.hh
- Connection ()
- Connection (bool te)
- Connection (const char *db, const char *host = "", const char *user = "", const char *passwd = "", bool te = true)
- Connection (const char *db, const char *host, const char *user, const char *passwd, uint port, my_bool compress = 1, unsigned int connect_timeout = 5, bool te = true, cchar *socket_name = "")
- int affected_rows ()
- operator bool ()
returns success()
- string clinet_info ()
- void close ()
- bool connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "")
- bool connected () const
returns true if a successful connection was made
- bool create_db (string db)
- bool drop_db (string db)
- int errnum ()
- string error ()
last error message()
- bool exec (const string &str)
- ResNSel execute (const string &str)
- ResNSel execute (const string &str, bool te)
- st_mysql_options get_options (void) const
- string host_info ()
- string info ()
- string infoo (void)
- int insert_id ()
- int kill (unsigned long pid)
- bool lock ()
- int ping (void)
- int proto_info ()
- void purge (void)
- inline Query query ()
- int read_options (enum mysql_option option,const char *arg)
- bool real_connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "", uint port = 0, my_bool compress = 0, unsigned int connect_timeout = 60, cchar *socket_name= "")
- int refresh (unsigned int refresh_options)
- bool reload ()
- bool select_db (const char *db)
- bool select_db (string db)
- string server_info ()
- bool shutdown ()
- string stat ()
- Result store (const string &str)
- Result store (const string &str, bool te)
- template class T void storein (dequeT &con, const string &s)
- template class T void storein (listT &con, const string &s)
- template class T void storein (multisetT &con, const string &s)
- template class T void storein (setT &con, const string &s)
- template class T void storein (slistT &con, const string &s)
- template class T void storein (vectorT &con, const string &s)
- template class Sequence void storein_sequence (Sequence &, const string &)
- template class Set void storein_set (Set &, const string &)
Stores the results in TYPE.
- bool success ()
returns true of the last query was successful
- void unlock ()
- ResUse use (const string &str)
- ResUse use (const string &str, bool te)
- ~ Connection ()
- friend Query
- friend ResNSel
- friend ResUse
returns success()
returns true if a successful connection was made
last error message()
Stores the results in TYPE.
Stores the result in TYPE. TYPE must be some sort of STL container.
returns true of the last query was successful
A special type for holding mysql Dates.
instantiable
public mysql_date, public MysqlDTbaseDate
datetime1.hh
Date, a comparable data structures for holding mysql Dates. It also
responds to the stream extraction and insertion operator.
- Date ()
- Date (cchar* str)
- Date (const string &str)
- Date (const string &str)
- short int compare (const Date& other) const
A combinate of Date and Time for holding mysql DateTime's
instantiable
public mysql_date, public mysql_time, public MysqlDTbaseDateTime
datetime1.hh
- DateTime ()
- DateTime (cchar* str)
- DateTime (const string &str)
- DateTime (const string &str)
- short int compare (const DateTime& other) const
- cchar* convert (cchar*)
- ostream& out_stream (ostream&) const
A vector of the field names.
instantiable
public vectorstring
field_names1.hh
- FieldNames ()
- FieldNames (const ResUse *res)
- FieldNames (int i)
- 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
returns the index number of the field with that name
Creates a new list from the data in res.
Creates a new list with i field names.
returns the field name of the field with that index number
returns the field name of the field with that index number
returns the index number of the field with that name
A vector of the field types.
instantiable
public vectormysql_type_info
field_types1.hh
- FieldTypes ()
- FieldTypes (const ResUse *res)
- FieldTypes (int i)
- 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
Returns the field type for the field with an offset of i.
Creates a new list based on the info in res
Creates a new list with i fields.
Returns the field type for the field with an offset of i.
Returns the field type for the field with an offset of i.
A vector like container with the raw mysql field info.
instantiable
public const_subscript_containerFields, Field
fields1.hh
- Fields ()
- Fields (ResUse *r)
- const Field& operator (int i) const
- const Field& operator (size_type i) const
- size_type size () const
the number of fields.Returns the field with an offset of i;
the number of fields.Returns the field with an offset of i;
instantiable
public unary_functionconst MysqlRow&, bool
compare1.hh
- MysqlCmp (uint i, const BinaryPred &f, const CmpType &c)
- bool operator () (const MysqlRow& cmp1) const
- CmpType cmp2
- BinaryPred func
- unsigned int index
instantiable
public MysqlCmpBinaryPred, const char *
compare1.hh
- MysqlCmpCStr (uint i, const BinaryPred &f, const char* c)
- bool operator () (const MysqlRow& cmp1) const
abstract
datetime1.hh
- virtual short int compare (const T &other) const
- bool operator != (const T &other) const
- bool operator (const T &other) const
- bool operator = (const T &other) const
- bool operator == (const T &other) const
- bool operator (const T &other) const
- bool operator = (const T &other) const
instantiable
set1.hh
- MysqlListInsert (T *o)
- void operator () (const value_type &data)
instantiable
set1.hh
- MysqlSetInsert (T *o)
- void operator () (const key_type &data)
Container class for holding null types.
instantiable
null1.hh
- Null ()
- Null (Type x)
- Null (const null_type &n)
Gives Null the null value
- Type data
- bool is_null
- Null& operator = (const null_type &n)
- Null& operator = (const null_type &n)
- typedef Type value_type
Gives Null the null value
Note
Type to use for the behavior parameter for *Null*
instantiable
null1.hh
- static const char * null_is ()
- static ostream& null_ostr (ostream &o)
Type to use for the behavior parameter for *Null*
instantiable
null1.hh
- static null_type null_is ()
- static ostream& null_ostr (ostream& o)
Type to use for the behavior parameter for *Null*
instantiable
null1.hh
- static int null_is ()
- static ostream& null_ostr (ostream &o)
A Query class suitable for executing queries.
instantiable
public SQLQuery
query1.hh
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.
- Query (Connection *m, bool te = false)
Create a new query object attached to a connection.
- Query (const Query &q)
- string error ()
The error message if the query was not successful.
- bool exec (const string &str)
Executes the query in the string buffer.
- template class T Query& insert (const T &v)
- Query& operator = (const Query &q)
- string preview ()
- string preview (parms &p)
- template class T Query& replace (const T &v)
- bool success ()
Displays the string currently in the buffer.
Create a new query object attached to a connection.
The error message if the query was not successful.
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
Displays the string currently in the buffer.
Same thing as string().
This structure holds the information on the success of queries thatdon't return any results.
instantiable
result1.hh
- ResNSel ()
- ResNSel (Connection *q)
- operator bool ()
If the query was successful
- string info
Additional info
- int insert_id
- int rows
Number of rows affected
- bool success
If the query was successful
Additional info
Number of rows affected
instantiable
result1.hh
- ResUse ()
- ResUse (MYSQL_RES *result, Connection *m = NULL, bool te = false)
- ResUse (const ResUse &other)
- operator bool () const
- unsigned int columns () const
- bool eof () const
raw c api function
- Field& fetch_field () const
raw c api field function
- long unsigned int * fetch_lengths () const
raw c api function
- Row fetch_row ()
raw c api function
- 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 int field_num (const string&) const
Returns the offset of the filed which equals str.
- void field_seek (int field)
raw c api field function
- 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
- 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.
- MYSQL_RES * mysql_result (void)
- 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 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.
- int num_fields () const
raw c api field function
- bool operator != (const ResUse &other) const
- inline ResUse& operator = (const ResUse &other)
- bool operator == (const ResUse &other) const
- void parent_leaving ()
- void purge (void)
- inline void reset_field_names ()
Resets the field names to there original values.
- inline void reset_field_types ()
Resets the field_types to their original values.
- inline void reset_names ()
Resets the field names to their original values.
- inline void reset_types ()
Resets the field_types to their original values.
- string& table ()
table name
- const string& table () const
table name
- inline FieldTypes& types ()
Returns a reference to the underlying FieldTypes
- inline const FieldTypes& types () const
Returns a const reference to the underlying FieldTypes
- 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.
- ~ ResUse ()
- Fields _fields
- mutable FieldNames * _names
- string _table
- mutable FieldTypes * _types
- void copy (const ResUse& other)
- Connection * mysql
- mutable MYSQL_RES * mysql_res
- bool throw_exceptions, initialized
raw c api function
raw c api field function
raw c api function
raw c api function
Returns the field with an offset of i.
Returns the field with an offset of i.
Returns a reference to the underlying FieldNames class.
Returns a const reference to the underlaying FieldNames class.
Returns the offset of the filed which equals str.
raw c api field function
Returns a reference to the mysql field type for the field with an offset of i.
Returns a const reference to the mysql field type for the field with an offset of i.
Returns a reference to the underlying FieldTypes
Returns a const reference to the underlying FieldTypes
returns a reference to the underling Fields structure.
returns a reference to the the mysql field info for a field with an offset of i.
Returns a reference to the underlying FieldNames class.
Returns a const reference to the underlying FieldNames class.
Returns the offset of the filed which equals str.
Returns the field with an offset of i.
Returns the field with an offset of i.
raw c api field function
Resets the field names to there original values.
Resets the field_types to their original values.
Resets the field names to their original values.
Resets the field_types to their original values.
table name
table name
Returns a reference to the underlying FieldTypes
Returns a const reference to the underlying FieldTypes
Returns a reference to the mysql field type for the field with an offset of i.
Returns a const reference to the mysql field type for the field with an offset of i.
This class handles the result set.
instantiable
public ResUse, public const_subscript_containerResult,Row,const Row
result1.hh
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.
- Result ()
- Result (MYSQL_RES *result, bool te = false)
- Result (const Result &other)
- void data_seek (uint offset) const
Raw c api function
- const Row fetch_row () const
Raw c api function
- int num_rows () const
Raw c api function
- const Row operator (size_type i) const
Returns the row with an offset of i.
- size_type rows () const
Returns the number of rows.
- size_type size () const
Returns the number of rows
- virtual ~ Result ()
Raw c api function
Raw c api function
Raw c api function
Returns the row with an offset of i.
Returns the number of rows.
Returns the number of rows
raw mysql c api functions
This class handles the actual rows in an intelligent manner.
instantiable
public const_subscript_containerRow,ColData,const ColData, public RowTemplateRow, ResUse
row1.hh
- Row ()
- Row (MYSQL_ROW d, const ResUse *r, unsigned int *jj, bool te = false)
- operator bool () const
Returns true if there is data in the row.
- inline const ColData operator (const string &i) const
Returns the value of the field with the field name of i.Returns the value of the field with the field name of i.
- inline const ColData operator (const string &i) const
Returns the value of the field with the field name of i.Returns the value of the field with the field name of i.
- const ColData operator (int i) const
- inline const ColData operator (size_type i) const
Returns the value of the field with the index of i.
- const ResUse& parent () const
- const char * raw_data (int i) const
- Row& self ()
- const Row& self () const
- inline size_type size () const
Returns the number of columns.
- ~ Row ()
Returns true if there is data in the row.
Returns the value of the field with the field name of 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.
This method is not nearly as effecent as using the index number. Use sparingly.
Returns the value of the field with the field name of 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.
This method is not nearly as effecent as using the index number. Use sparingly.
Returns the value of the field with the index of i.
Returns the number of columns.
abstract
row1.hh
- equal_list_baFieldNames,ThisType,quote_type0 equal_list (const char *d = ",", const char *e = " = ") const
- template class Manip equal_list_baFieldNames,ThisType,Manip equal_list (const char *d, const char *e, Manip m) const
- value_list_bFieldNames,quote_type0 field_list (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) const
- value_list_bFieldNames,quote_type0 field_list (const vectorbool &vb) const
- value_list_bFieldNames,quote_type0 field_list (const vectorbool &vb) const
- template class Manip value_list_baFieldNames,Manip field_list (const char *d, Manip m) const
- template class Manip value_list_bFieldNames,Manip field_list (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) const
- template class Manip value_list_bFieldNames,Manip field_list (const char *d, Manip m, const vectorbool &vb) const
- template class Manip value_list_bFieldNames,Manip field_list (const char *d, Manip m, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- value_list_bFieldNames,quote_type0 field_list (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) const
- value_list_bFieldNames,quote_type0 field_list (const char *d, const vectorbool &vb) const
- value_list_bFieldNames,quote_type0 field_list (const char *d, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- value_list_bFieldNames,quote_type0 field_list (string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- virtual const Res & parent () const
- value_list_bThisType,quote_type0 value_list (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) const
- value_list_bThisType,quote_type0 value_list (const vectorbool &vb) const
- value_list_bThisType,quote_type0 value_list (const vectorbool &vb) const
- template class Manip value_list_baThisType,Manip value_list (const char *d, Manip m) const
- template class Manip value_list_bThisType,Manip value_list (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) const
- template class Manip value_list_bThisType,Manip value_list (const char *d, Manip m, const vectorbool &vb) const
- template class Manip value_list_bThisType,Manip value_list (const char *d, Manip m, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- value_list_bThisType,quote_type0 value_list (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) const
- value_list_bThisType,quote_type0 value_list (const char *d, const vectorbool &vb) const
- value_list_bThisType,quote_type0 value_list (const char *d, string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- value_list_bThisType,quote_type0 value_list (string s0, string s1="", string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string sa="", string sb="", string sc="") const
- virtual ~ RowTemplate ()
- virtual ThisType& self ()
- virtual const ThisType& self () const
equal_list
value_list
field_list
instantiable
sql_query1.hh
- SQLParseElement (string b, char o, char n)
- string before
- char num
- char option
The "pure" query class
instantiable
public strstream
sql_query1.hh
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()*.
- SQLQuery ()
- SQLQuery (const SQLQuery &q)
- operator bool ()
- SQLQueryParms def
The default template parameters set.
- string error () const
- template class T SQLQuery& insert (const T &v)
- mysql_query_define_const1 (string,str)
- bool operator ! ()
Returns the full query string.Like str(query_reset) but sets the parameters.
- SQLQuery& operator = (const SQLQuery &q)
- void parse ()
- template class T SQLQuery& replace (const T &v)
- bool success () const
- bool Success
- char* errmsg
- typedef SQLQueryParms parms
- vectorSQLParseElement parsed
- vectorstring parsed_names
- mapstring,int parsed_nums
- void proc (parms &p)
- typedef const SQLString& ss
The default template parameters set.
Returns the full query string.Like str(query_reset) but sets the parameters.
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.
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.
Exception thrown when not enough parameters are provided
instantiable
sql_query1.hh
Thrown when not enough parameters are provided for a
template query.
- SQLQueryNEParms (const char *c)
- const char* error
This class holds the parameter values for filling template queries.
instantiable
public vectorSQLString
sql_query1.hh
It is a subclass of a vector of *SQLStrings*.
- SQLQueryParms ()
- SQLQueryParms (SQLQuery *p)
- bool bound ()
- void clear ()
Clears the list
- SQLQueryParms operator + (const SQLQueryParms &other) const
Set the elements.
- SQLQueryParms & operator += (const SQLString &str)
Adds an element to the list
- SQLQueryParms & operator (const SQLString &str)
Adds an element to the list
- 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.
- SQLString & operator (size_type n)
Access element number n
- const SQLString & operator (size_type n) const
Access element number n
- void set (ss a)
- void set (ss a, ss b)
- void set (ss a, ss b, ss c)
- void set (ss a, ss b, ss c, ss d)
- void set (ss a, ss b, ss c, ss d, ss e)
- void set (ss a, ss b, ss c, ss d, ss e, ss f)
- void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g)
- void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h)
- void set (ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h, ss i)
- void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j)
- void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j,ss k)
- void set (ss a,ss b,ss c,ss d,ss e,ss f,ss g,ss h,ss i,ss j,ss k,ss l)
Clears the list
Set the elements.
Sets element 0 to a, element 1 to b, etc. May specify up to a dozen elements
Adds an element to the list
Adds an element to the list
Access the value of the element with a key of str.
Access the value of the element with a key of str.
Access element number n
Access element number n
A special string that will convert from anything.
instantiable
public string
sql_string1.hh
A class subclassed from string that has the additional ability to
convert from any valid mysql type.
- SQLString ()
- SQLString (char i)
- SQLString (const char *str)
- SQLString (const char *str)
- SQLString (double i)
- SQLString (float i)
- SQLString (int i)
- SQLString (short int i)
- SQLString (unsigned int i)
- SQLString (unsigned int i)
- SQLString (unsigned int i)
- bool dont_escape
- bool is_string
- SQLString& operator = (const string& str)
- SQLString& operator = (const string& str)
- bool processed
A Special Set for holding mysql sets.
instantiable
public Container
set1.hh
- Set (const ColData &str)
- Set (const ColData &str)
- Set (const ColData &str)
- ostream& out_stream (ostream &s) const
- operator string ()
A special type for holding mysql Dates.
instantiable
public mysql_time, public MysqlDTbaseTime
datetime1.hh
Time, a comparable data structures for holding mysql Times. It also
responds to the stream extraction and insertion operator.
- Time ()
- Time (cchar* str)
- Time (const string &str)
- Time (const string &str)
- short int compare (const Time& other) const
A special string that is created from a existing const char *
instantiable
const_string1.hh
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.
- const_iterator begin () const
- const char* c_str () const
- typedef const char* const_iterator
- typedef const char* const_pointer
- typedef const char& const_reference
- const_string ()
- const_string (const char *str)
- const char* data () const
- typedef int difference_type
- const_iterator end () const
- typedef const_iterator iterator
The same as const_iterator because the data can not be changed.
- size_type length () const
- size_type max_size () const
- const_reference operator (size_type pos) const
- typedef const_pointer pointer
- typedef const_reference reference
- typedef unsigned int size_type
- typedef const char value_type
The same as const_iterator because the data can not be changed.
A container adapter to make a container into a Random Access Container.
abstract
resiter1.hh
The requirements are that the container has the member functions
*operator[] (SizeType)* _and_ *size()* defined.
- iterator begin () const
- typedef iterator const_iterator
- typedef value_type* const_pointer
- typedef value_type& const_reference
- typedef const ::reverse_iteratorconst_iterator const_reverse_iterator
- typedef DiffType difference_type
- bool empty () const
- iterator end () const
- typedef subscript_iteratorconst this_type, ReturnType, SizeType, DiffType iterator
- size_type max_size () const
- virtual ReturnType operator (SizeType i) const
- typedef value_type* pointer
- reverse_iterator rbegin () const
- typedef value_type& reference
- reverse_iterator rend () const
- typedef const ::reverse_iteratoriterator reverse_iterator
- virtual size_type size () const
- typedef SizeType size_type
- typedef const_subscript_containerOnType,ValueType,ReturnType,SizeType,DiffType this_type
- typedef ValueType value_type
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
bin_char_pred
compare1.hh
- bool operator () (const char *x, const char *y) const
instantiable
manip1.hh
- do_nothing_type1 (ostream *o)
- ostream * ostr
instantiable
manip1.hh
- do_nothing_type2 (SQLQueryParms *p)
- SQLQueryParms * qparms
instantiable
vallist1.hh
- const char * delem
- equal_list_b (const Seq1 &s1, const Seq2 &s2, const vectorbool &f, const char *d, const char *e, Manip m)
- const char * equl
- const vectorbool fields
- const Seq1 * list1
- const Seq2 * list2
- Manip manip
instantiable
vallist1.hh
- const char * delem
- equal_list_ba (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, Manip m)
- const char * equl
- const Seq1 * list1
- const Seq2 * list2
- Manip manip
instantiable
manip1.hh
- escape_type1 (ostream *o)
- ostream * ostr
instantiable
manip1.hh
- escape_type2 (SQLQueryParms *p)
- SQLQueryParms * qparms
instantiable
manip1.hh
- ignore_type2 (SQLQueryParms *p)
- SQLQueryParms * qparms
Base class for auto-converting column data. Do not use directly.
instantiable
public Str
coldata1.hh
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.
bfDo not use this class directly./bf
Use the typedef ColData or MutableColData instead.
- template class T, class B operator NullT,B () const
- operator cchar* () const
- operator unsigned char () const
- operator unsigned char () const
- templateclass Type Type conv (Type dummy) const
Converts the column data to TYPE.
- operator double () const
- bool escape_q () const
Returns true of false depending on if the data is of a type thatshould be escaped
- inline const string& get_string (void) const
- operator unsigned long int () const
- operator unsigned long int () const
- operator unsigned long int () const
- operator unsigned long int () const
- operator unsigned long int () const
- operator unsigned long int () const
- inline const bool is_null (void) const
- void it_is_null (void)
- mysql_ColData ()
- bool quote_q () const
Returns true or false depending on if the data is of a type thatshould be quoted
- mysql_type_info type ()
Returns the current mysql type of current item
- operator ulonglong () const
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)
Returns true of false depending on if the data is of a type thatshould be escaped
Returns true or false depending on if the data is of a type thatshould be quoted
Returns the current mysql type of current item
instantiable
convert1.hh
instantiable
virtual public mysql_dt_base
datetime1.hh
- cchar* convert (cchar*)
- tiny_int day
- tiny_int month
- ostream& out_stream (ostream&) const
- short int year
- short int compare (const mysql_date *other) const
abstract
datetime1.hh
- virtual ostream& out_stream (ostream&) const
- operator string ()
instantiable
type_info1.hh
- friend mysql_ti_sql_type_info_lookup
- friend mysql_type_info
instantiable
type_info1.hh
instantiable
virtual public mysql_dt_base
datetime1.hh
- cchar* convert (cchar*)
- tiny_int hour
- tiny_int minute
- ostream& out_stream (ostream&) const
- tiny_int second
- short int compare (const mysql_time *other) const
Class that holds basic type information for ColData.
instantiable
type_info1.hh
- unsigned int _length
- unsigned int _max_length
- inline const mysql_type_info base_type () const
Returns the type_info for the C++ type inside of the Null type.
- bool before (mysql_type_info &b)
Provides ordering
- inline const type_info& c_type () const
- bool escape_q () const
Returns true if the sql type is of a type that needs to be escaped.
- int id () const
Returns the id of the sql_type.
- inline const unsigned int length () const
- inline const unsigned int max_length () const
Returns the type_info for the C++ type associated with the sql type.
- mysql_type_info ()
- mysql_type_info (const type_info &t)
- mysql_type_info (const type_info &t)
- inline mysql_type_info (const MYSQL_FIELD &f)
- inline mysql_type_info (enum_field_types t, bool _unsigned, bool _null)
- mysql_type_info (unsigned char n)
- inline const char* name () const
Returns a implication defined name of the c++ type.
- mysql_type_info& operator = (const type_info &t)
- mysql_type_info& operator = (const type_info &t)
- mysql_type_info& operator = (unsigned char n)
- bool quote_q () const
Returns true if the sql type is of a type that needs to be quoted.
- inline const char* sql_name () const
Returns the name for the sql type.
- static const unsigned char string_type
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()
Provides ordering
You can also use id() for the same purpose.
Returns true if the sql type is of a type that needs to be escaped.
Returns the id of the sql_type.
Note: Do not ever use this id directly as it may change between versions.
Returns the type_info for the C++ type associated with the sql type.
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.
Returns true if the sql type is of a type that needs to be quoted.
Returns the name for the sql type.
instantiable
null1.hh
- template class Type operator Type ()
instantiable
manip1.hh
- ostream * ostr
- quote_double_only_type1 (ostream *o)
instantiable
manip1.hh
- SQLQueryParms * qparms
- quote_double_only_type2 (SQLQueryParms *p)
instantiable
manip1.hh
- ostream * ostr
- quote_only_type1 (ostream *o)
instantiable
manip1.hh
- SQLQueryParms * qparms
- quote_only_type2 (SQLQueryParms *p)
instantiable
manip1.hh
- ostream * ostr
- quote_type1 (ostream *o)
instantiable
manip1.hh
- SQLQueryParms * qparms
- quote_type2 (SQLQueryParms *p)
instantiable
vallist1.hh
- Iter _begin
- Iter _end
- Iter begin () const
- typedef Iter const_iterator
- Iter end () const
- simp_list_b (Iter b, Iter e)
instantiable
public random_access_iteratorReturnType, SizeType
resiter1.hh
- bool operator != (const subscript_iterator &j) const
- ReturnType operator * () const
- subscript_iterator operator + (SizeType n) const
- subscript_iterator& operator ++ ()
- subscript_iterator operator ++ (int)
- subscript_iterator& operator += (SizeType n)
- subscript_iterator operator - (SizeType n) const
- DiffType operator - (const subscript_iterator &j) const
- subscript_iterator& operator - ()
- subscript_iterator operator - (int)
- subscript_iterator& operator -= (SizeType n)
- ReturnType operator - () const
- bool operator (const subscript_iterator &j) const
- bool operator = (const subscript_iterator &j) const
- bool operator == (const subscript_iterator &j) const
- bool operator (const subscript_iterator &j) const
- bool operator = (const subscript_iterator &j) const
- ReturnType operator (SizeType n) const
- subscript_iterator ()
- subscript_iterator (OnType *what, SizeType pos)
instantiable
type_info1.hh
- bool operator() (const type_info *lhs, const type_info *rhs) const
instantiable
vallist1.hh
- const char * delem
- const vectorbool fields
- const Seq * list
- Manip manip
- value_list_b (const Seq &s, const vectorbool &f, const char *d, Manip m)
instantiable
vallist1.hh
- const char * delem
- const Seq * list
- Manip manip
- value_list_ba (const Seq &s, const char* d, Manip m)
5.66 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-09-25