next up previous contents
Next: 6. Template Queries Up: Usage Previous: 4. Tutorial by Example   Contents

Subsections

5. Class Reference

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 struct BadConversion

Exception structure thrown when a bad conversion takes place

Type

instantiable

Include file

coldata1.hh

Synopsis

Public methods

Public methods

public BadConversion (const char* tn, const char* d, size_t r, size_t a)

public size_t actual_size

public const string data

public size_t retrieved

public const char* type_name

5.2 class BadNullConversion

Thrown when a *Null* value is trying to be converted into a type it can't convert to.

Type

instantiable

Include file

null1.hh

Synopsis

5.3 class Connection

The main database handle

Type

instantiable

Include file

connection1.hh

Synopsis

Public methods

Friend methods

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 ()

returns success()

public string clinet_info ()

public void close ()

public bool connect (cchar *db = "", cchar *host = "", cchar *user = "", cchar *passwd = "")

public bool connected () const

returns true if a successful connection was made

public bool create_db (string db)

public bool drop_db (string db)

public int errnum ()

public string error ()

last error message()

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 (deque$<$T$>$ &con, const string &s)

public template $<$class T$>$ void storein (list$<$T$>$ &con, const string &s)

public template $<$class T$>$ void storein (multiset$<$T$>$ &con, const string &s)

public template $<$class T$>$ void storein (set$<$T$>$ &con, const string &s)

public template $<$class T$>$ void storein (slist$<$T$>$ &con, const string &s)

public template $<$class T$>$ void storein (vector$<$T$>$ &con, const string &s)

public template $<$class Sequence$>$ void storein_sequence (Sequence &, const string &)

public template $<$class Set$>$ void storein_set (Set &, const string &)

Stores the results in TYPE.

Stores the result in TYPE. TYPE must be some sort of STL container.

public bool success ()

returns true of the last query was successful

public void unlock ()

public ResUse use (const string &str)

public ResUse use (const string &str, bool te)

public ~ Connection ()

Friend methods

friend friend Query

friend friend ResNSel

friend friend ResUse

5.4 struct Date

A special type for holding mysql Dates.

Type

instantiable

Superclasses

public mysql_date, public MysqlDTbase$<$Date$>$

Include file

datetime1.hh

Detailed description

Date, a comparable data structures for holding mysql Dates. It also responds to the stream extraction and insertion operator.

Synopsis

Public methods

Public methods

public Date ()

public Date (cchar* str)

public Date (const string &str)

public Date (const string &str)

public short int compare (const Date& other) const

5.5 struct DateTime

A combinate of Date and Time for holding mysql DateTime's

Type

instantiable

Superclasses

public mysql_date, public mysql_time, public MysqlDTbase$<$DateTime$>$

Include file

datetime1.hh

Synopsis

Public methods

Public methods

public DateTime ()

public DateTime (cchar* str)

public DateTime (const string &str)

public DateTime (const string &str)

public short int compare (const DateTime& other) const

public cchar* convert (cchar*)

public ostream& out_stream (ostream&) const

5.6 class FieldNames

A vector of the field names.

Type

instantiable

Superclasses

public vector$<$string$>$

Include file

field_names1.hh

Synopsis

Public methods

Public methods

public FieldNames ()

public FieldNames (const ResUse *res)

public FieldNames (int i)

public FieldNames& operator = (const ResUse *res)

Creates a new list from the data in res.

public FieldNames& operator = (int i)

Creates a new list with i field names.

public string& operator (int i)

returns the field name of the field with that index number

public const string& operator (int i) const

returns the field name of the field with that index number

public uint operator (string i) const

returns the index number of the field with that name

5.7 class FieldTypes

A vector of the field types.

Type

instantiable

Superclasses

public vector$<$mysql_type_info$>$

Include file

field_types1.hh

Synopsis

Public methods

Public methods

public FieldTypes ()

public FieldTypes (const ResUse *res)

public FieldTypes (int i)

public FieldTypes& operator = (const ResUse *res)

Creates a new list based on the info in res

public FieldTypes& operator = (int i)

Creates a new list with i fields.

public mysql_type_info& operator (int i)

Returns the field type for the field with an offset of i.

public const mysql_type_info& operator (int i) const

Returns the field type for the field with an offset of i.

5.8 class Fields

A vector like container with the raw mysql field info.

Type

instantiable

Superclasses

public const_subscript_container$<$Fields, Field$>$

Include file

fields1.hh

Synopsis

Public methods

Public methods

public Fields ()

public Fields (ResUse *r)

public const Field& operator (int i) const

public const Field& operator (size_type i) const

public size_type size () const

the number of fields.Returns the field with an offset of i;

5.9 template class MysqlCmp $<$class BinaryPred, class CmpType$>$

Type

instantiable

Superclasses

public unary_function$<$const MysqlRow&, bool$>$

Include file

compare1.hh

Synopsis

Public methods

Protected methods

Public methods

public MysqlCmp (uint i, const BinaryPred &f, const CmpType &c)

public bool operator () (const MysqlRow& cmp1) const

Protected methods

protected CmpType cmp2

protected BinaryPred func

protected unsigned int index

5.10 template class MysqlCmpCStr $<$class BinaryPred$>$

Type

instantiable

Superclasses

public MysqlCmp$<$BinaryPred, const char *$>$

Include file

compare1.hh

Synopsis

Public methods

Public methods

public MysqlCmpCStr (uint i, const BinaryPred &f, const char* c)

public bool operator () (const MysqlRow& cmp1) const

5.11 template struct MysqlDTbase $<$class T$>$

Type

abstract

Include file

datetime1.hh

Synopsis

Public methods

Public methods

public pure virtual short int compare (const T &other) const

public bool operator != (const T &other) const

public bool operator $<$ (const T &other) const

public bool operator $<$= (const T &other) const

public bool operator == (const T &other) const

public bool operator $>$ (const T &other) const

public bool operator $>$= (const T &other) const

5.12 template class MysqlListInsert $<$class T, class value_type = typename T::value_type$>$

Type

instantiable

Include file

set1.hh

Synopsis

Public methods

Public methods

public MysqlListInsert (T *o)

public void operator () (const value_type &data)

5.13 template class MysqlSetInsert $<$class T, class key_type = typename T::key_type$>$

Type

instantiable

Include file

set1.hh

Synopsis

Public methods

Public methods

public MysqlSetInsert (T *o)

public void operator () (const key_type &data)

5.14 template class Null $<$class Type, class Behavior = NullisNull$>$

Container class for holding null types.

Type

instantiable

Include file

null1.hh

Synopsis

Public methods

Public methods

public Null ()

public Null (Type x)

public Null (const null_type &n)

Gives Null the null value

Note

public Type data

public bool is_null

public Null& operator = (const null_type &n)

public Null& operator = (const null_type &n)

public typedef Type value_type

5.15 struct NullisBlank

Type to use for the behavior parameter for *Null$<$$>$*

Type

instantiable

Include file

null1.hh

Synopsis

Public methods

Public methods

public static const char * null_is ()

public static ostream& null_ostr (ostream &o)

5.16 struct NullisNull

Type to use for the behavior parameter for *Null$<$$>$*

Type

instantiable

Include file

null1.hh

Synopsis

Public methods

Public methods

public static null_type null_is ()

public static ostream& null_ostr (ostream& o)

5.17 struct NullisZero

Type to use for the behavior parameter for *Null$<$$>$*

Type

instantiable

Include file

null1.hh

Synopsis

Public methods

Public methods

public static int null_is ()

public static ostream& null_ostr (ostream &o)

5.18 class Query

A Query class suitable for executing queries.

Type

instantiable

Superclasses

public SQLQuery

Include file

query1.hh

Detailed description

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.

Synopsis

Public methods

Public methods

public Query (Connection *m, bool te = false)

Create a new query object attached to a connection.

public Query (const Query &q)

public string error ()

The error message if the query was not successful.

public bool exec (const string &str)

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

public template $<$class T$>$ Query& insert (const T &v)

public Query& operator = (const Query &q)

public string preview ()

public string preview (parms &p)

public template $<$class T$>$ Query& replace (const T &v)

public bool success ()

Displays the string currently in the buffer.

Same thing as string().

5.19 struct ResNSel

This structure holds the information on the success of queries thatdon't return any results.

Type

instantiable

Include file

result1.hh

Synopsis

Public methods

Public methods

public ResNSel ()

public ResNSel (Connection *q)

public operator bool ()

If the query was successful

public string info

Additional info

public int insert_id

public int rows

Number of rows affected

public bool success

5.20 class ResUse

Type

instantiable

Include file

result1.hh

Synopsis

Public methods

Protected methods

Friend methods

Public methods

public ResUse ()

public ResUse (MYSQL_RES *result, Connection *m = NULL, bool te = false)

public ResUse (const ResUse &other)

public operator bool () const

public unsigned int columns () const

public bool eof () const

raw c api function

public Field& fetch_field () const

raw c api field function

public long unsigned int *fetch_lengths () const

raw c api function

public Row fetch_row ()

raw c api function

public inline string& field_name (int)

Returns the field with an offset of i.

public inline const string& field_name (int) const

Returns the field with an offset of i.

public inline FieldNames& field_names ()

Returns a reference to the underlying FieldNames class.

public inline const FieldNames& field_names () const

Returns a const reference to the underlaying FieldNames class.

public inline int field_num (const string&) const

Returns the offset of the filed which equals str.

public void field_seek (int field)

raw c api field function

public inline mysql_type_info& field_type (int i)

Returns a reference to the mysql field type for the field with an offset of i.

public 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.

public inline FieldTypes& field_types ()

Returns a reference to the underlying FieldTypes

public inline const FieldTypes& field_types () const

Returns a const reference to the underlying FieldTypes

public const Fields& fields () const

returns a reference to the underling Fields structure.

public const Field& fields (unsigned int i) const

returns a reference to the the mysql field info for a field with an offset of i.

public MYSQL_RES *mysql_result (void)

public inline FieldNames& names ()

Returns a reference to the underlying FieldNames class.

public inline const FieldNames& names () const

Returns a const reference to the underlying FieldNames class.

public inline int names (const string& s) const

Returns the offset of the filed which equals str.

public inline string& names (int i)

Returns the field with an offset of i.

public inline const string& names (int i) const

Returns the field with an offset of i.

public int num_fields () const

raw c api field function

public bool operator != (const ResUse &other) const

public inline ResUse& operator = (const ResUse &other)

public bool operator == (const ResUse &other) const

public void parent_leaving ()

public void purge (void)

public inline void reset_field_names ()

Resets the field names to there original values.

public inline void reset_field_types ()

Resets the field_types to their original values.

public inline void reset_names ()

Resets the field names to their original values.

public inline void reset_types ()

Resets the field_types to their original values.

public string& table ()

table name

public const string& table () const

table name

public inline FieldTypes& types ()

Returns a reference to the underlying FieldTypes

public inline const FieldTypes& types () const

Returns a const reference to the underlying FieldTypes

public inline mysql_type_info& types (int i)

Returns a reference to the mysql field type for the field with an offset of i.

public 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.

public ~ ResUse ()

Protected methods

protected Fields _fields

protected mutable FieldNames *_names

protected string _table

protected mutable FieldTypes *_types

protected void copy (const ResUse& other)

protected Connection *mysql

protected mutable MYSQL_RES *mysql_res

protected bool throw_exceptions, initialized

Friend methods

friend friend Connection

5.21 class Result

This class handles the result set.

Type

instantiable

Superclasses

public ResUse, public const_subscript_container$<$Result,Row,const Row$>$

Include file

result1.hh

Detailed description

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.

Synopsis

Public methods

Friend methods

Public methods

public Result ()

public Result (MYSQL_RES *result, bool te = false)

public Result (const Result &other)

public void data_seek (uint offset) const

Raw c api function

public const Row fetch_row () const

Raw c api function

public int num_rows () const

Raw c api function

public const Row operator (size_type i) const

Returns the row with an offset of i.

public size_type rows () const

Returns the number of rows.

public size_type size () const

Returns the number of rows

public virtual ~ Result ()

raw mysql c api functions

Friend methods

friend friend Connection

5.22 class Row

This class handles the actual rows in an intelligent manner.

Type

instantiable

Superclasses

public const_subscript_container$<$Row,ColData,const ColData$>$, public RowTemplate$<$Row, ResUse$>$

Include file

row1.hh

Synopsis

Public methods

Public methods

public Row ()

public Row (MYSQL_ROW d, const ResUse *r, unsigned int *jj, bool te = false)

public operator bool () const

Returns true if there is data in the row.

public 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.

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.

public 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.

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.

public const ColData operator (int i) const

public inline const ColData operator (size_type i) const

Returns the value of the field with the index of i.

public const ResUse& parent () const

public const char *raw_data (int i) const

public Row& self ()

public const Row& self () const

public inline size_type size () const

Returns the number of columns.

public ~ Row ()

5.23 template class RowTemplate $<$class ThisType, class Res$>$

Type

abstract

Include file

row1.hh

Synopsis

Public methods

Protected methods

Public methods

public equal_list_ba$<$FieldNames,ThisType,quote_type0$>$ equal_list (const char *d = ",", const char *e = " = ") const

public template $<$class Manip$>$ equal_list_ba$<$FieldNames,ThisType,Manip$>$ equal_list (const char *d, const char *e, Manip m) const

public value_list_b$<$FieldNames,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_b$<$FieldNames,quote_type0$>$ field_list (const vector$<$bool$>$ &vb) const

public value_list_b$<$FieldNames,quote_type0$>$ field_list (const vector$<$bool$>$ &vb) const

public template $<$class Manip$>$ value_list_ba$<$FieldNames,Manip$>$ field_list (const char *d, Manip m) const

public template $<$class Manip$>$ value_list_b$<$FieldNames,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_b$<$FieldNames,Manip$>$ field_list (const char *d, Manip m, const vector$<$bool$>$ &vb) const

public template $<$class Manip$>$ value_list_b$<$FieldNames,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_b$<$FieldNames,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_b$<$FieldNames,quote_type0$>$ field_list (const char *d, const vector$<$bool$>$ &vb) const

public value_list_b$<$FieldNames,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_b$<$FieldNames,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

equal_list

public pure virtual const Res & parent () const

value_list

public value_list_b$<$ThisType,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_b$<$ThisType,quote_type0$>$ value_list (const vector$<$bool$>$ &vb) const

public value_list_b$<$ThisType,quote_type0$>$ value_list (const vector$<$bool$>$ &vb) const

public template $<$class Manip$>$ value_list_ba$<$ThisType,Manip$>$ value_list (const char *d, Manip m) const

public template $<$class Manip$>$ value_list_b$<$ThisType,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_b$<$ThisType,Manip$>$ value_list (const char *d, Manip m, const vector$<$bool$>$ &vb) const

public template $<$class Manip$>$ value_list_b$<$ThisType,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_b$<$ThisType,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_b$<$ThisType,quote_type0$>$ value_list (const char *d, const vector$<$bool$>$ &vb) const

public value_list_b$<$ThisType,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_b$<$ThisType,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

field_list

public virtual ~ RowTemplate ()

Protected methods

protected pure virtual ThisType& self ()

protected pure virtual const ThisType& self () const

5.24 struct SQLParseElement

Type

instantiable

Include file

sql_query1.hh

Synopsis

Public methods

Public methods

public SQLParseElement (string b, char o, char n)

public string before

public char num

public char option

5.25 class SQLQuery

The "pure" query class

Type

instantiable

Superclasses

public strstream

Include file

sql_query1.hh

Detailed description

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()*.

Synopsis

Public methods

Protected methods

Friend methods

Public methods

public SQLQuery ()

public SQLQuery (const SQLQuery &q)

public operator bool ()

public SQLQueryParms def

The default template parameters set.

public string error () const

public template $<$class T$>$ SQLQuery& insert (const T &v)

public mysql_query_define_const1 (string,str)

public bool operator ! ()

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.

public SQLQuery& operator = (const SQLQuery &q)

public void parse ()

public template $<$class T$>$ SQLQuery& replace (const T &v)

public bool success () const

Protected methods

protected bool Success

protected char* errmsg

protected typedef SQLQueryParms parms

protected vector$<$SQLParseElement$>$ parsed

protected vector$<$string$>$ parsed_names

protected map$<$string,int$>$ parsed_nums

protected void proc (parms &p)

protected typedef const SQLString& ss

Friend methods

friend friend SQLQueryParms

5.26 struct SQLQueryNEParms

Exception thrown when not enough parameters are provided

Type

instantiable

Include file

sql_query1.hh

Detailed description

Thrown when not enough parameters are provided for a template query.

Synopsis

Public methods

Public methods

public SQLQueryNEParms (const char *c)

public const char* error

5.27 class SQLQueryParms

This class holds the parameter values for filling template queries.

Type

instantiable

Superclasses

public vector$<$SQLString$>$

Include file

sql_query1.hh

Detailed description

It is a subclass of a vector of *SQLStrings*.

Synopsis

Public methods

Friend methods

Public methods

public SQLQueryParms ()

public SQLQueryParms (SQLQuery *p)

public bool bound ()

public void clear ()

Clears the list

public SQLQueryParms operator + (const SQLQueryParms &other) const

Set the elements.

Sets element 0 to a, element 1 to b, etc. May specify up to a dozen elements

public SQLQueryParms &operator += (const SQLString &str)

Adds an element to the list

public SQLQueryParms &operator $<$$<$ (const SQLString &str)

Adds an element to the list

public SQLString &operator (const char *str)

Access the value of the element with a key of str.

public const SQLString &operator (const char *str) const

Access the value of the element with a key of str.

public SQLString &operator (size_type n)

Access element number n

public const SQLString &operator (size_type n) const

Access element number n

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

friend friend Query

5.28 class SQLString

A special string that will convert from anything.

Type

instantiable

Superclasses

public string

Include file

sql_string1.hh

Detailed description

A class subclassed from string that has the additional ability to convert from any valid mysql type.

Synopsis

Public methods

Public methods

public SQLString ()

public SQLString (char i)

public SQLString (const char *str)

public SQLString (const char *str)

public SQLString (double i)

public SQLString (float i)

public SQLString (int i)

public SQLString (short int i)

public SQLString (unsigned int i)

public SQLString (unsigned int i)

public SQLString (unsigned int i)

public bool dont_escape

public bool is_string

public SQLString& operator = (const string& str)

public SQLString& operator = (const string& str)

public bool processed

5.29 template class Set $<$class Container = set$<$string$>$ $>$

A Special Set for holding mysql sets.

Type

instantiable

Superclasses

public Container

Include file

set1.hh

Synopsis

Public methods

Public methods

public Set (const ColData &str)

public Set (const ColData &str)

public Set (const ColData &str)

public ostream& out_stream (ostream &s) const

public operator string ()

5.30 struct Time

A special type for holding mysql Dates.

Type

instantiable

Superclasses

public mysql_time, public MysqlDTbase$<$Time$>$

Include file

datetime1.hh

Detailed description

Time, a comparable data structures for holding mysql Times. It also responds to the stream extraction and insertion operator.

Synopsis

Public methods

Public methods

public Time ()

public Time (cchar* str)

public Time (const string &str)

public Time (const string &str)

public short int compare (const Time& other) const

5.31 class const_string

A special string that is created from a existing const char *

Type

instantiable

Include file

const_string1.hh

Detailed description

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.

Synopsis

Public methods

Public methods

public const_iterator begin () const

public const char* c_str () const

public typedef const char* const_iterator

public typedef const char* const_pointer

public typedef const char& const_reference

public const_string ()

public const_string (const char *str)

public const char* data () const

public typedef int difference_type

public const_iterator end () const

public typedef const_iterator iterator

The same as const_iterator because the data can not be changed.

public size_type length () const

public size_type max_size () const

public const_reference operator (size_type pos) const

public typedef const_pointer pointer

public typedef const_reference reference

public typedef unsigned int size_type

public typedef const char value_type

5.32 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.

Type

abstract

Include file

resiter1.hh

Detailed description

The requirements are that the container has the member functions *operator[] (SizeType)* _and_ *size()* defined.

Synopsis

Public methods

Public methods

public iterator begin () const

public typedef iterator const_iterator

public typedef value_type* const_pointer

public typedef value_type& const_reference

public typedef const ::reverse_iterator$<$const_iterator$>$ const_reverse_iterator

public typedef DiffType difference_type

public bool empty () const

public iterator end () const

public typedef subscript_iterator$<$const this_type, ReturnType, SizeType, DiffType$>$ iterator

public size_type max_size () const

public pure virtual ReturnType operator (SizeType i) const

public typedef value_type* pointer

public reverse_iterator rbegin () const

public typedef value_type& reference

public reverse_iterator rend () const

public typedef const ::reverse_iterator$<$iterator$>$ reverse_iterator

public pure virtual size_type size () const

public typedef SizeType size_type

public typedef const_subscript_container$<$OnType,ValueType,ReturnType,SizeType,DiffType$>$ this_type

public typedef ValueType value_type

5.33 struct cstr_equal_to

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.34 struct cstr_greater

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.35 struct cstr_greater_equal

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.36 struct cstr_less

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.37 struct cstr_less_equal

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.38 struct cstr_not_equal_to

Type

instantiable

Superclasses

bin_char_pred

Include file

compare1.hh

Synopsis

Public methods

Public methods

public bool operator () (const char *x, const char *y) const

5.39 struct do_nothing_type1

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public do_nothing_type1 (ostream *o)

public ostream *ostr

5.40 struct do_nothing_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public do_nothing_type2 (SQLQueryParms *p)

public SQLQueryParms *qparms

5.41 template struct equal_list_b $<$class Seq1, class Seq2, class Manip$>$

Type

instantiable

Include file

vallist1.hh

Synopsis

Public methods

Public methods

public const char *delem

public equal_list_b (const Seq1 &s1, const Seq2 &s2, const vector$<$bool$>$ &f, const char *d, const char *e, Manip m)

public const char *equl

public const vector$<$bool$>$ fields

public const Seq1 *list1

public const Seq2 *list2

public Manip manip

5.42 template struct equal_list_ba $<$class Seq1, class Seq2, class Manip$>$

Type

instantiable

Include file

vallist1.hh

Synopsis

Public methods

Public methods

public const char *delem

public equal_list_ba (const Seq1 &s1, const Seq2 &s2, const char *d, const char *e, Manip m)

public const char *equl

public const Seq1 *list1

public const Seq2 *list2

public Manip manip

5.43 struct escape_type1

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public escape_type1 (ostream *o)

public ostream *ostr

5.44 struct escape_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public escape_type2 (SQLQueryParms *p)

public SQLQueryParms *qparms

5.45 struct ignore_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public ignore_type2 (SQLQueryParms *p)

public SQLQueryParms *qparms

5.46 template class mysql_ColData $<$class Str$>$

Base class for auto-converting column data. Do not use directly.

Type

instantiable

Superclasses

public Str

Include file

coldata1.hh

Detailed description

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.

Synopsis

Public methods

Public methods

public template $<$class T, class B$>$ operator Null$<$T,B$>$ () const

public operator cchar* () const

public operator unsigned char () const

public operator unsigned char () const

public template$<$class Type$>$ Type conv (Type dummy) 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)

public operator double () const

public bool escape_q () const

Returns true of false depending on if the data is of a type thatshould be escaped

public inline const string& get_string (void) const

public operator unsigned long int () const

public operator unsigned long int () const

public operator unsigned long int () const

public operator unsigned long int () const

public operator unsigned long int () const

public operator unsigned long int () const

public inline const bool is_null (void) const

public void it_is_null (void)

public mysql_ColData ()

public bool quote_q () const

Returns true or false depending on if the data is of a type thatshould be quoted

public mysql_type_info type ()

Returns the current mysql type of current item

public operator ulonglong () const

5.47 class mysql_convert

Type

instantiable

Include file

convert1.hh

Synopsis

5.48 struct mysql_date

Type

instantiable

Superclasses

virtual public mysql_dt_base

Include file

datetime1.hh

Synopsis

Public methods

Protected methods

Public methods

public cchar* convert (cchar*)

public tiny_int day

public tiny_int month

public ostream& out_stream (ostream&) const

public short int year

Protected methods

protected short int compare (const mysql_date *other) const

5.49 struct mysql_dt_base

Type

abstract

Include file

datetime1.hh

Synopsis

Public methods

Public methods

public pure virtual ostream& out_stream (ostream&) const

public operator string ()

5.50 class mysql_ti_sql_type_info

Type

instantiable

Include file

type_info1.hh

Synopsis

Friend methods

Friend methods

friend friend mysql_ti_sql_type_info_lookup

friend friend mysql_type_info

5.51 class mysql_ti_sql_type_info_lookup

Type

instantiable

Include file

type_info1.hh

Synopsis

Friend methods

Friend methods

friend friend mysql_type_info

5.52 struct mysql_time

Type

instantiable

Superclasses

virtual public mysql_dt_base

Include file

datetime1.hh

Synopsis

Public methods

Protected methods

Public methods

public cchar* convert (cchar*)

public tiny_int hour

public tiny_int minute

public ostream& out_stream (ostream&) const

public tiny_int second

Protected methods

protected short int compare (const mysql_time *other) const

5.53 class mysql_type_info

Class that holds basic type information for ColData.

Type

instantiable

Include file

type_info1.hh

Synopsis

Public methods

Public methods

public unsigned int _length

public unsigned int _max_length

public 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()

public bool before (mysql_type_info &b)

Provides ordering

You can also use id() for the same purpose.

public inline const type_info& c_type () const

public bool escape_q () const

Returns true if the sql type is of a type that needs to be escaped.

public int id () const

Returns the id of the sql_type.

Note: Do not ever use this id directly as it may change between versions.

public inline const unsigned int length () const

public inline const unsigned int max_length () const

Returns the type_info for the C++ type associated with the sql type.

public mysql_type_info ()

public mysql_type_info (const type_info &t)

public mysql_type_info (const type_info &t)

public inline mysql_type_info (const MYSQL_FIELD &f)

public inline mysql_type_info (enum_field_types t, bool _unsigned, bool _null)

public mysql_type_info (unsigned char n)

public 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.

public mysql_type_info& operator = (const type_info &t)

public mysql_type_info& operator = (const type_info &t)

public mysql_type_info& operator = (unsigned char n)

public bool quote_q () const

Returns true if the sql type is of a type that needs to be quoted.

public inline const char* sql_name () const

Returns the name for the sql type.

public static const unsigned char string_type

5.54 class null_type

Type

instantiable

Include file

null1.hh

Synopsis

Public methods

Public methods

public template $<$class Type$>$ operator Type ()

5.55 struct quote_double_only_type1

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public ostream *ostr

public quote_double_only_type1 (ostream *o)

5.56 struct quote_double_only_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public SQLQueryParms *qparms

public quote_double_only_type2 (SQLQueryParms *p)

5.57 struct quote_only_type1

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public ostream *ostr

public quote_only_type1 (ostream *o)

5.58 struct quote_only_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public SQLQueryParms *qparms

public quote_only_type2 (SQLQueryParms *p)

5.59 struct quote_type1

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public ostream *ostr

public quote_type1 (ostream *o)

5.60 struct quote_type2

Type

instantiable

Include file

manip1.hh

Synopsis

Public methods

Public methods

public SQLQueryParms *qparms

public quote_type2 (SQLQueryParms *p)

5.61 template class simp_list_b $<$class Iter$>$

Type

instantiable

Include file

vallist1.hh

Synopsis

Public methods

Public methods

public Iter _begin

public Iter _end

public Iter begin () const

public typedef Iter const_iterator

public Iter end () const

public simp_list_b (Iter b, Iter e)

5.62 template class subscript_iterator $<$class OnType, class ReturnType, class SizeType, class DiffType$>$

Type

instantiable

Superclasses

public random_access_iterator$<$ReturnType, SizeType$>$

Include file

resiter1.hh

Synopsis

Public methods

Public methods

public bool operator != (const subscript_iterator &j) const

public ReturnType operator * () const

public subscript_iterator operator + (SizeType n) const

public subscript_iterator& operator ++ ()

public subscript_iterator operator ++ (int)

public subscript_iterator& operator += (SizeType n)

public subscript_iterator operator - (SizeType n) const

public DiffType operator - (const subscript_iterator &j) const

public subscript_iterator& operator - ()

public subscript_iterator operator - (int)

public subscript_iterator& operator -= (SizeType n)

public ReturnType operator -$>$ () const

public bool operator $<$ (const subscript_iterator &j) const

public bool operator $<$= (const subscript_iterator &j) const

public bool operator == (const subscript_iterator &j) const

public bool operator $>$ (const subscript_iterator &j) const

public bool operator $>$= (const subscript_iterator &j) const

public ReturnType operator (SizeType n) const

public subscript_iterator ()

public subscript_iterator (OnType *what, SizeType pos)

\begin{figure}\vbox{\include{tiny_int}
}\end{figure}

5.63 struct type_info_cmp

Type

instantiable

Include file

type_info1.hh

Synopsis

Public methods

Public methods

public bool operator() (const type_info *lhs, const type_info *rhs) const

5.64 template struct value_list_b $<$class Seq, class Manip$>$

Type

instantiable

Include file

vallist1.hh

Synopsis

Public methods

Public methods

public const char *delem

public const vector$<$bool$>$ fields

public const Seq *list

public Manip manip

public value_list_b (const Seq &s, const vector$<$bool$>$ &f, const char *d, Manip m)

5.65 template struct value_list_ba $<$class Seq, class Manip$>$

Type

instantiable

Include file

vallist1.hh

Synopsis

Public methods

Public methods

public const char *delem

public const Seq *list

public Manip manip

public 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 up previous contents
Next: 6. Template Queries Up: Usage Previous: 4. Tutorial by Example   Contents
2000-09-25