0% encontró este documento útil (0 votos)
168 vistas229 páginas

MySQL++ Manual de Referencia SEO

Este documento presenta el manual de referencia de MySQL++. Describe las clases principales como Connection, Query, Result y Row. También describe la característica de estructuras SQL especializadas que permiten manipular datos en la base de datos usando estructuras de datos nativas de C++. Recomienda enviar preguntas sobre la biblioteca a la lista de correo de MySQL++ en lugar de contactar a desarrolladores individualmente.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
168 vistas229 páginas

MySQL++ Manual de Referencia SEO

Este documento presenta el manual de referencia de MySQL++. Describe las clases principales como Connection, Query, Result y Row. También describe la característica de estructuras SQL especializadas que permiten manipular datos en la base de datos usando estructuras de datos nativas de C++. Recomienda enviar preguntas sobre la biblioteca a la lista de correo de MySQL++ en lugar de contactar a desarrolladores individualmente.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd

MySQL++ Reference Manual

2.3.2

Generated by Doxygen 1.3.5

Wed Jul 11 [Link] 2007

Contents
1 MySQL++ Reference Manual

1.1

Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2

Major Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3

Major Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4

If You Have Questions... . . . . . . . . . . . . . . . . . . . . . . .

1.5

Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 MySQL++ Namespace Index


2.1

MySQL++ Namespace List . . . . . . . . . . . . . . . . . . . . .

3 MySQL++ Hierarchical Index


3.1

MySQL++ Class Hierarchy . . . . . . . . . . . . . . . . . . . . .

4 MySQL++ Class Index


4.1

MySQL++ Class List . . . . . . . . . . . . . . . . . . . . . . . .

5 MySQL++ File Index


5.1

MySQL++ File List . . . . . . . . . . . . . . . . . . . . . . . . .

6 MySQL++ Namespace Documentation


6.1

mysqlpp Namespace Reference . . . . . . . . . . . . . . . . . . .

7 MySQL++ Class Documentation

3
3

5
5

7
7

11
11

13
13

41

7.1

AutoFlag< T > Class Template Reference . . . . . . . . . . . . .

41

7.2

mysqlpp::BadConversion Class Reference . . . . . . . . . . . . . .

43

ii

CONTENTS
7.3

mysqlpp::BadFieldName Class Reference . . . . . . . . . . . . . .

45

7.4

mysqlpp::BadNullConversion Class Reference . . . . . . . . . . .

46

7.5

mysqlpp::BadOption Class Reference . . . . . . . . . . . . . . . .

47

7.6

mysqlpp::BadParamCount Class Reference . . . . . . . . . . . . .

48

7.7

mysqlpp::BadQuery Class Reference . . . . . . . . . . . . . . . .

49

7.8

mysqlpp::BasicLock Class Reference . . . . . . . . . . . . . . . .

50

7.9

mysqlpp::ColData_Tmpl< Str > Class Template Reference . . .

52

7.10 mysqlpp::Connection Class Reference . . . . . . . . . . . . . . . .

58

7.11 mysqlpp::ConnectionFailed Class Reference . . . . . . . . . . . .

71

7.12 mysqlpp::const_string Class Reference . . . . . . . . . . . . . . .

72

7.13 mysqlpp::const_subscript_container< OnType, ValueType,


ReturnType, SizeType, DiType > Class Template Reference . .

75

7.14 mysqlpp::Date Struct Reference . . . . . . . . . . . . . . . . . . .

78

7.15 mysqlpp::DateTime Struct Reference . . . . . . . . . . . . . . . .

81

7.16 mysqlpp::DBSelectionFailed Class Reference . . . . . . . . . . . .

84

7.17 mysqlpp::DTbase< T > Struct Template Reference . . . . . . . .

85

7.18 mysqlpp::EndOfResults Class Reference . . . . . . . . . . . . . .

87

7.19 mysqlpp::EndOfResultSets Class Reference . . . . . . . . . . . .

88

7.20 mysqlpp::equal_list_b< Seq1, Seq2, Manip > Struct Template


Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

7.21 mysqlpp::equal_list_ba< Seq1, Seq2, Manip > Struct Template


Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

91

7.22 mysqlpp::Exception Class Reference . . . . . . . . . . . . . . . .

93

7.23 mysqlpp::FieldNames Class Reference . . . . . . . . . . . . . . .

95

7.24 mysqlpp::Fields Class Reference . . . . . . . . . . . . . . . . . . .

96

7.25 mysqlpp::FieldTypes Class Reference . . . . . . . . . . . . . . . .

97

7.26 mysqlpp::Lock Class Reference . . . . . . . . . . . . . . . . . . .

99

7.27 mysqlpp::Lockable Class Reference . . . . . . . . . . . . . . . . . 100


7.28 mysqlpp::LockFailed Class Reference . . . . . . . . . . . . . . . . 102
7.29 mysqlpp::mysql_type_info Class Reference . . . . . . . . . . . . 103
7.30 mysqlpp::NoExceptions Class Reference . . . . . . . . . . . . . . 109
7.31 mysqlpp::Null< Type, Behavior > Class Template Reference . . 110

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

CONTENTS

iii

7.32 mysqlpp::null_type Class Reference . . . . . . . . . . . . . . . . 114


7.33 mysqlpp::NullisBlank Struct Reference . . . . . . . . . . . . . . . 115
7.34 mysqlpp::NullisNull Struct Reference . . . . . . . . . . . . . . . . 116
7.35 mysqlpp::NullisZero Struct Reference . . . . . . . . . . . . . . . . 117
7.36 mysqlpp::ObjectNotInitialized Class Reference

. . . . . . . . . . 118

7.37 mysqlpp::OptionalExceptions Class Reference . . . . . . . . . . . 119


7.38 mysqlpp::Query Class Reference . . . . . . . . . . . . . . . . . . . 121
7.39 mysqlpp::ResNSel Class Reference . . . . . . . . . . . . . . . . . 139
7.40 mysqlpp::Result Class Reference . . . . . . . . . . . . . . . . . . 140
7.41 mysqlpp::ResUse Class Reference . . . . . . . . . . . . . . . . . . 142
7.42 mysqlpp::Row Class Reference . . . . . . . . . . . . . . . . . . . . 148
7.43 mysqlpp::scoped_var_set< T > Class Template Reference . . . 160
7.44 mysqlpp::Set< Container > Class Template Reference . . . . . . 161
7.45 mysqlpp::SQLParseElement Struct Reference . . . . . . . . . . . 162
7.46 mysqlpp::SQLQueryParms Class Reference . . . . . . . . . . . . 164
7.47 mysqlpp::SQLString Class Reference . . . . . . . . . . . . . . . . 167
7.48 mysqlpp::subscript_iterator< OnType, ReturnType, SizeType,
DiType > Class Template Reference . . . . . . . . . . . . . . . 170
7.49 mysqlpp::Time Struct Reference . . . . . . . . . . . . . . . . . . . 173
7.50 mysqlpp::tiny_int Class Reference . . . . . . . . . . . . . . . . . 176
7.51 mysqlpp::Transaction Class Reference . . . . . . . . . . . . . . . 179
7.52 mysqlpp::value_list_b< Seq, Manip > Struct Template Reference 181
7.53 mysqlpp::value_list_ba< Seq, Manip > Struct Template Reference183

8 MySQL++ File Documentation

185

8.1

autoag.h File Reference . . . . . . . . . . . . . . . . . . . . . . . 185

8.2

coldata.h File Reference . . . . . . . . . . . . . . . . . . . . . . . 186

8.3

common.h File Reference . . . . . . . . . . . . . . . . . . . . . . 187

8.4

connection.h File Reference . . . . . . . . . . . . . . . . . . . . . 188

8.5

const_string.h File Reference . . . . . . . . . . . . . . . . . . . . 189

8.6

convert.h File Reference . . . . . . . . . . . . . . . . . . . . . . . 190

8.7

datetime.h File Reference . . . . . . . . . . . . . . . . . . . . . . 191

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

iv

CONTENTS
8.8

exceptions.h File Reference . . . . . . . . . . . . . . . . . . . . . 192

8.9

eld_names.h File Reference . . . . . . . . . . . . . . . . . . . . 193

8.10 eld_types.h File Reference . . . . . . . . . . . . . . . . . . . . . 194


8.11 elds.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 195
8.12 lockable.h File Reference . . . . . . . . . . . . . . . . . . . . . . . 196
8.13 manip.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 197
8.14 myset.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 198
8.15 mysql++.h File Reference . . . . . . . . . . . . . . . . . . . . . . 199
8.16 noexceptions.h File Reference . . . . . . . . . . . . . . . . . . . . 201
8.17 null.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.18 qparms.h File Reference . . . . . . . . . . . . . . . . . . . . . . . 203
8.19 query.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 204
8.20 resiter.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 206
8.21 result.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 207
8.22 row.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . 208
8.23 sql_string.h File Reference . . . . . . . . . . . . . . . . . . . . . 209
8.24 sql_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . 210
8.25 stream2string.h File Reference

. . . . . . . . . . . . . . . . . . . 211

8.26 string_util.h File Reference . . . . . . . . . . . . . . . . . . . . . 212


8.27 tiny_int.h File Reference . . . . . . . . . . . . . . . . . . . . . . 213
8.28 transaction.h File Reference . . . . . . . . . . . . . . . . . . . . . 214
8.29 type_info.h File Reference . . . . . . . . . . . . . . . . . . . . . . 215
8.30 vallist.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . 216

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 1

MySQL++ Reference Manual


1.1 Getting Started
The best place to get started is the user manual. It provides a guide to the
example programs and more.

1.2 Major Classes


In MySQL++, the main user-facing classes are mysqlpp::Connection(p. 58),
mysqlpp::Query(p. 121),
mysqlpp::Result(p. 140),
and
mysqlpp::Row(p. 148).
In addition, MySQL++ has a mechanism called Specialized SQL Structures
(SSQLS), which allow you to create C++ structures that parallel the denition
of the tables in your database schema. These let you manipulate the data in
your database using native C++ data structures. Programs using this feature
often include very little SQL code, because MySQL++ can generate most of
what you need automatically when using SSQLSes. There is a whole chapter in
the user manual on how to use this feature of the library, plus a section in the
user manual's tutorial chapter to introduce it. It's possible to use MySQL++
eectively without using SSQLS, but it sure makes some things a lot easier.

1.3 Major Files


The only two header les your program ever needs to include are mysql++.h,
and optionally custom.h. (The latter implements the SSQLS mechanism.) All
of the other les are used within the library only.

MySQL++ Reference Manual

1.4 If You Have Questions...


If you want to email someone to ask questions about this library, we greatly
prefer that you send mail to the MySQL++ mailing list, which you can subscribe
to here: [Link]
That mailing list is archived, so if you have questions, do a search to see if the
question has been asked before.
You may nd people's individual email addresses in various les within the MySQL++ distribution. Please do not send mail to them unless you are sending
something that is inherently personal. Questions that are about MySQL++
usage may well be ignored if you send them to our personal email accounts.
Those of us still active in MySQL++ development monitor the mailing list, so
you aren't getting any extra "coverage" by sending messages to those addresses
in addition to the mailing list.

1.5 Licensing
MySQL++ is licensed under the GNU Lesser General Public License,
which you should have received with the distribution package in a
le called "LGPL" or "LICENSE".
You can also view it here:
[Link] or receive a copy by writing to Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 021101301, USA.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 2

MySQL++ Namespace Index


2.1 MySQL++ Namespace List
Here is a list of all documented namespaces with brief descriptions:

mysqlpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

MySQL++ Namespace Index

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 3

MySQL++ Hierarchical
Index
3.1 MySQL++ Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
AutoFlag< T > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
mysqlpp::ColData_Tmpl< Str > . . . . . . . . . . . . . . . . . . . . . 52
mysqlpp::const_string . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
mysqlpp::const_subscript_container< OnType, ValueType, ReturnType, SizeType, DiType > . . . . . . . . . . . . . . . . . . . 75
mysqlpp::const_subscript_container< Fields, Field > . . . . . . . . . 75
mysqlpp::Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
mysqlpp::const_subscript_container< Result, Row, const Row > . . . 75
mysqlpp::Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
mysqlpp::const_subscript_container< Row, ColData, const ColData > 75
mysqlpp::Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
mysqlpp::DTbase< T > . . . . . . . . . . . . . . . . . . . . . . . . . . 85
mysqlpp::DTbase< Date > . . . . . . . . . . . . . . . . . . . . . . . . 85
mysqlpp::Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
mysqlpp::DTbase< DateTime > . . . . . . . . . . . . . . . . . . . . . 85
mysqlpp::DateTime . . . . . . . . . . . . . . . . . . . . . . . . . . 81
mysqlpp::DTbase< Time > . . . . . . . . . . . . . . . . . . . . . . . . 85
mysqlpp::Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
mysqlpp::equal_list_b< Seq1, Seq2, Manip > . . . . . . . . . . . . . 89
mysqlpp::equal_list_ba< Seq1, Seq2, Manip > . . . . . . . . . . . . . 91
mysqlpp::Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

MySQL++ Hierarchical Index


mysqlpp::BadConversion . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BadFieldName . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BadNullConversion . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BadOption . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BadParamCount . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BadQuery . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::ConnectionFailed . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::DBSelectionFailed . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::EndOfResults . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::EndOfResultSets . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::LockFailed . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::ObjectNotInitialized . . . . . . . . . . . . . . . . . . . . .
mysqlpp::FieldNames . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::FieldTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::BasicLock . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Lockable . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Connection . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::mysql_type_info . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NoExceptions . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Null< Type, Behavior > . . . . . . . . . . . . . . . . . . . .
mysqlpp::null_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NullisBlank . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NullisNull . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NullisZero . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::OptionalExceptions . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Connection . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::ResUse . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Result . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::ResNSel . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::scoped_var_set< T > . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Set< Container > . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::SQLParseElement . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::SQLQueryParms . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::SQLString . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::subscript_iterator< OnType, ReturnType, SizeType, DiType > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::tiny_int . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::value_list_b< Seq, Manip > . . . . . . . . . . . . . . . . . .
mysqlpp::value_list_ba< Seq, Manip > . . . . . . . . . . . . . . . . .

43
45
46
47
48
49
71
84
87
88
102
118
95
97
99
50
100
58
121
103
109
110
114
115
116
117
119
58
121
142
140
148
139
160
161
162
164
167
170
176
179
181
183

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 4

MySQL++ Class Index


4.1 MySQL++ Class List
Here are the classes, structs, unions and interfaces with brief descriptions:

AutoFlag< T > (A template for setting a ag on a variable as long

as the object that set it is in scope. Flag resets when object


goes out of scope. Works on anything that looks like bool ) .
mysqlpp::BadConversion (Exception(p. 93) thrown when a bad
type conversion is attempted ) . . . . . . . . . . . . . . . . .
mysqlpp::BadFieldName (Exception(p. 93) thrown when a requested named eld doesn't exist ) . . . . . . . . . . . . . . .
mysqlpp::BadNullConversion (Exception(p. 93) thrown when
you attempt to convert a SQL null to an incompatible type )
mysqlpp::BadOption (Exception(p. 93) thrown when you pass an
unrecognized option to Connection::set_option()(p. 69) )
mysqlpp::BadParamCount (Exception(p. 93) thrown when not
enough query parameters are provided ) . . . . . . . . . . . .
mysqlpp::BadQuery (Exception(p. 93) thrown when MySQL encounters a problem while processing your query ) . . . . . . .
mysqlpp::BasicLock (Trivial Lock(p. 99) subclass, using a boolean
variable as the lock ag ) . . . . . . . . . . . . . . . . . . . .
mysqlpp::ColData_Tmpl< Str > (Template for string data that
can convert itself to any standard C data type ) . . . . . . . .
mysqlpp::Connection (Manages the connection to the MySQL
database ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::ConnectionFailed (Exception(p. 93) thrown when there
is a problem establishing the database server connection. It's
also thrown if Connection::shutdown()(p. 70) fails ) . . . .

41
43
45
46
47
48
49
50
52
58
71

MySQL++ Class Index


mysqlpp::const_string (Wrapper for const char to make it be-

have in a way more useful to MySQL++ ) . . . . . . . . . . .

mysqlpp::const_subscript_container< OnType, ValueType,


ReturnType, SizeType, DiType > (A base class that

one derives from to become a random access container, which


can be accessed with subscript notation ) . . . . . . . . . . .
mysqlpp::Date (C++ form of MySQL's DATE type ) . . . . . . . .
mysqlpp::DateTime (C++ form of MySQL's DATETIME type ) . .
mysqlpp::DBSelectionFailed (Exception(p. 93) thrown when the
program tries to select a new database and the server refuses
for some reason ) . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::DTbase< T > (Base class template for MySQL++ date
and time classes ) . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::EndOfResults (Exception(p. 93) thrown when ResUse::fetch_row()(p. 146) walks o the end of a use-query's
result set ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::EndOfResultSets (Exception(p. 93) thrown when
Query::store_next()(p. 133) walks o the end of a
use-query's multi result sets ) . . . . . . . . . . . . . . . . . .
mysqlpp::equal_list_b< Seq1, Seq2, Manip > (Same as
equal_list_ba(p. 91), plus the option to have some elements
of the equals clause suppressed ) . . . . . . . . . . . . . . . .
mysqlpp::equal_list_ba< Seq1, Seq2, Manip > (Holds two lists
of items, typically used to construct a SQL "equals clause" )
mysqlpp::Exception (Base class for all MySQL++ custom exceptions ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::FieldNames (Holds a list of SQL eld names ) . . . . . .
mysqlpp::Fields (A container similar to std::vector for holding
mysqlpp::Field(p. 17) records ) . . . . . . . . . . . . . . . .
mysqlpp::FieldTypes (A vector of SQL eld types ) . . . . . . . . .
mysqlpp::Lock (Abstract base class for lock implementation, used by
Lockable(p. 100) ) . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::Lockable (Interface allowing a class to declare itself as
"lockable" ) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::LockFailed (Exception(p. 93) thrown when a Lockable(p. 100) object fails ) . . . . . . . . . . . . . . . . . . . .
mysqlpp::mysql_type_info (Holds basic type information for ColData ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NoExceptions (Disable exceptions in an object derived
from OptionalExceptions(p. 119) ) . . . . . . . . . . . . . .
mysqlpp::Null< Type, Behavior > (Class for holding data from a
SQL column with the NULL attribute ) . . . . . . . . . . . .
mysqlpp::null_type (The type of the global mysqlpp::null(p. 25)
object ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mysqlpp::NullisBlank (Class for objects that dene SQL null as a
blank C string ) . . . . . . . . . . . . . . . . . . . . . . . . . .

72

75
78
81
84
85
87
88
89
91
93
95
96
97
99
100
102
103
109
110
114
115

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

4.1 MySQL++ Class List

mysqlpp::NullisNull (Class for objects that dene SQL null in terms


of MySQL++'s null_type(p. 114) ) . . . . . . . . . . . . . . 116
mysqlpp::NullisZero (Class for objects that dene SQL null as 0 ) . 117
mysqlpp::ObjectNotInitialized (Exception(p. 93) thrown when
you try to use an object that isn't completely initialized ) . . 118

mysqlpp::OptionalExceptions (Interface allowing a class to have

optional exceptions ) . . . . . . . . . . . . . . . . . . . . . . . 119

mysqlpp::Query (A class for building and executing SQL queries ) . 121


mysqlpp::ResNSel (Holds the information on the success of queries

that don't return any results ) . . . . . . . . . . . . . . . . . . 139

mysqlpp::Result (This class manages SQL result sets ) . . . . . . . 140


mysqlpp::ResUse (A basic result set class, for use with "use" queries )142
mysqlpp::Row (Manages rows from a result set ) . . . . . . . . . . . 148
mysqlpp::scoped_var_set< T > (Sets a variable to a given value
temporarily ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

mysqlpp::Set< Container > (A special std::set derivative for hold-

ing MySQL data sets ) . . . . . . . . . . . . . . . . . . . . . . 161

mysqlpp::SQLParseElement (Used within Query(p. 121) to hold

elements for parameterized queries ) . . . . . . . . . . . . . . 162

mysqlpp::SQLQueryParms (This class holds the parameter values

for lling template queries ) . . . . . . . . . . . . . . . . . . . 164

mysqlpp::SQLString (A specialized std::string that will convert

from any valid MySQL type ) . . . . . . . . . . . . . . . . . . 167

mysqlpp::subscript_iterator< OnType, ReturnType, SizeType, DiType > (Iterator that can be subscripted ) . . . 170
mysqlpp::Time (C++ form of MySQL's TIME type ) . . . . . . . . 173
mysqlpp::tiny_int (Class for holding an SQL tiny_int(p. 176) ob-

ject ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

mysqlpp::Transaction (Helper object for creating exception-safe

SQL transactions ) . . . . . . . . . . . . . . . . . . . . . . . . 179

mysqlpp::value_list_b< Seq, Manip > (Same as value_list_ba(p. 183), plus the option to have some elements of the list

suppressed ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

mysqlpp::value_list_ba< Seq, Manip > (Holds a list of items,

typically used to construct a SQL "value list" ) . . . . . . . . 183

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

10

MySQL++ Class Index

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 5

MySQL++ File Index


5.1 MySQL++ File List
Here is a list of all documented les with brief descriptions:

autoag.h (Denes a template for setting a ag within a given variable

scope, and resetting it when exiting that scope ) . . . . . . .


coldata.h (Declares classes for converting string data to any of the
basic C types ) . . . . . . . . . . . . . . . . . . . . . . . . . .
common.h (This le includes top-level denitions for use both internal
to the library, and outside it. Contrast mysql++.h ) . . . . .
connection.h (Declares the Connection class ) . . . . . . . . . . . . .
const_string.h (Declares a wrapper for const char which behaves
in a way more useful to MySQL++ ) . . . . . . . . . . . . . .
convert.h (Declares various string-to-integer type conversion templates ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
datetime.h (Declares classes to add MySQL-compatible date and time
types to C++'s type system ) . . . . . . . . . . . . . . . . . .
exceptions.h (Declares the MySQL++-specic exception classes ) . .
eld_names.h (Declares a class to hold a list of eld names ) . . . .
eld_types.h (Declares a class to hold a list of SQL eld type info )
elds.h (Declares a class for holding information about a set of elds )
lockable.h (Declares interface that allows a class to declare itself as
"lockable" ) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
manip.h (Declares std::ostream manipulators useful with SQL syntax ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
myset.h (Declares templates for generating custom containers used
elsewhere in the library ) . . . . . . . . . . . . . . . . . . . .
mysql++.h (The main MySQL++ header le ) . . . . . . . . . . . .

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

12

MySQL++ File Index


noexceptions.h (Declares interface that allows exceptions to be optional )

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

null.h (Declares classes that implement SQL "null" semantics within

C++'s type system ) . . . . . . . . . . . . . . . . . . . . . . . 202

qparms.h (Declares the template query parameter-related stu ) . . 203


query.h (Denes a class for building and executing SQL queries ) . . 204
querydef.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ??
resiter.h (Declares templates for adapting existing classes to be iteratable random-access containers ) . . . . . . . . . . . . . . . . 206

result.h (Declares classes for holding SQL query result sets ) . . . . . 207
row.h (Declares the classes for holding row data from a result set ) . 208
sql_string.h (Declares an std::string derivative that adds some
things needed within the library ) . . . . . . . . . . . . . . . . 209

sql_types.h (Declares the closest C++ equivalent of each MySQL

column type ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

stream2string.h (Declares an adapter that converts something that

can be inserted into a C++ stream into a string type ) . . . . 211

string_util.h (Declares string-handling utility functions used within

the library ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

tiny_int.h (Declares class for holding a SQL tiny_int ) . . . . . . . 213


transaction.h (Declares the Transaction class ) . . . . . . . . . . . . 214
type_info.h (Declares classes that provide an interface between the
SQL and C++ type systems ) . . . . . . . . . . . . . . . . . . 215

vallist.h (Declares templates for holding lists of values ) . . . . . . . . 216

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 6

MySQL++ Namespace
Documentation
6.1 mysqlpp Namespace Reference
Classes
class BadConversion

Exception(p. 93) thrown when a bad type conversion is attempted.


class BadFieldName

Exception(p. 93) thrown when a requested named eld doesn't exist.


class BadNullConversion

Exception(p. 93) thrown when you attempt to convert a SQL null to an


incompatible type.
class BadOption

Exception(p. 93) thrown when you pass an unrecognized option to


Connection::set_option()(p. 69).
class BadParamCount

Exception(p. 93) thrown when not enough query parameters are provided.
class BadQuery

Exception(p. 93) thrown when MySQL encounters a problem while processing your query.

14

MySQL++ Namespace Documentation


class BasicLock

Trivial Lock(p. 99) subclass, using a boolean variable as the lock ag.

class ColData_Tmpl

Template for string data that can convert itself to any standard C data type.
class Connection

Manages the connection to the MySQL database.


struct Connection::OptionInfo
class ConnectionFailed

Exception(p. 93) thrown when there is a problem establishing the database


server connection. It's also thrown if Connection::shutdown()(p. 70)
fails.

class const_string

Wrapper for const char to make it behave in a way more useful to MySQL++.
class const_subscript_container

A base class that one derives from to become a random access container,
which can be accessed with subscript notation.
struct Date

C++ form of MySQL's DATE type.


struct DateTime

C++ form of MySQL's DATETIME type.


class DBSelectionFailed

Exception(p. 93) thrown when the program tries to select a new database
and the server refuses for some reason.

struct DTbase

Base class template for MySQL++ date and time classes.


class EndOfResults

Exception(p. 93) thrown when ResUse::fetch_row()(p. 146) walks o the


end of a use-query's result set.

class EndOfResultSets

Exception(p. 93) thrown when Query::store_next()(p. 133) walks o the


end of a use-query's multi result sets.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

15

struct equal_list_b

Same as equal_list_ba(p. 91), plus the option to have some elements of


the equals clause suppressed.

struct equal_list_ba

Holds two lists of items, typically used to construct a SQL "equals clause".
class Exception

Base class for all MySQL++ custom exceptions.


class FieldNames

Holds a list of SQL eld names.


class Fields

A container similar to std::vector for holding mysqlpp::Field(p. 17)


records.

class FieldTypes

A vector of SQL eld types.


class Lock

Abstract base class for lock implementation, used by Lockable(p. 100).

class Lockable

Interface allowing a class to declare itself as "lockable".


class LockFailed

Exception(p. 93) thrown when a Lockable(p. 100) object fails.

class mysql_type_info

Holds basic type information for ColData.


class NoExceptions

Disable exceptions in an object derived from OptionalExceptions(p. 119).

class Null

Class for holding data from a SQL column with the NULL attribute.
class null_type

The type of the global mysqlpp::null(p. 25) object.

struct NullisBlank

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

16

MySQL++ Namespace Documentation


Class for objects that dene SQL null as a blank C string.
struct NullisNull

Class for objects that dene SQL null in terms of MySQL++'s null_type(p. 114).

struct NullisZero

Class for objects that dene SQL null as 0.


class ObjectNotInitialized

Exception(p. 93) thrown when you try to use an object that isn't completely
initialized.

class OptionalExceptions

Interface allowing a class to have optional exceptions.


class Query

A class for building and executing SQL queries.


class ResNSel

Holds the information on the success of queries that don't return any results.
class Result

This class manages SQL result sets.


class ResUse

A basic result set class, for use with "use" queries.


class Row

Manages rows from a result set.


class scoped_var_set

Sets a variable to a given value temporarily.


class Set

A special std::set derivative for holding MySQL data sets.


struct SQLParseElement

Used within Query(p. 121) to hold elements for parameterized queries.

class SQLQueryParms

This class holds the parameter values for lling template queries.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

17

class SQLString

A specialized std::string that will convert from any valid MySQL type.
class subscript_iterator

Iterator that can be subscripted.


struct Time

C++ form of MySQL's TIME type.


class tiny_int

Class for holding an SQL tiny_int(p. 176) object.

class Transaction

Helper object for creating exception-safe SQL transactions.


struct value_list_b

Same as value_list_ba(p. 183), plus the option to have some elements of


the list suppressed.

struct value_list_ba

Holds a list of items, typically used to construct a SQL "value list".

Typedefs
typedef ColData_Tmpl< const_string > ColData

The type that is returned by constant rows.


typedef ColData_Tmpl< std::string > MutableColData

The type that is returned by mutable rows.


typedef MYSQL_FIELD Field

Alias for MYSQL_FIELD.

Enumerations

enum
enum
enum
enum
enum

quote_type0 { quote }
quote_only_type0 { quote_only }
quote_double_only_type0 { quote_double_only }
escape_type0 { escape }
do_nothing_type0 { do_nothing }

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

18

MySQL++ Namespace Documentation


enum ignore_type0 { ignore }
enum query_reset { DONT_RESET, RESET_QUERY }

Used for indicating whether a query object should auto-reset.

Functions
std::ostream & operator<< (std::ostream &o, const const_string &str)

Inserts a const_string(p. 72) into a C++ stream.

int compare (const const_string &lhs, const const_string &rhs)

Calls [Link](), passing rhs.


bool operator== (const_string &lhs, const_string &rhs)

Returns true if lhs is the same as rhs.


bool operator!= (const_string &lhs, const_string &rhs)

Returns true if lhs is not the same as rhs.


bool operator< (const_string &lhs, const_string &rhs)

Returns true if lhs is lexically less than rhs.


bool operator<= (const_string &lhs, const_string &rhs)

Returns true if lhs is lexically less or equal to rhs.


bool operator> (const_string &lhs, const_string &rhs)

Returns true if lhs is lexically greater than rhs.


bool operator>= (const_string &lhs, const_string &rhs)

Returns true if lhs is lexically greater than or equal to rhs.


std::ostream & operator<< (std::ostream &os, const Date &d)

Inserts a Date(p. 78) object into a C++ stream.

std::ostream & operator<< (std::ostream &os, const Time &t)

Inserts a Time(p. 173) object into a C++ stream in a MySQL-compatible


format.

std::ostream & operator<< (std::ostream &os, const DateTime &dt)

Inserts a DateTime(p. 81) object into a C++ stream in a MySQLcompatible format.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

19

SQLQueryParms & operator<< (quote_type2 p, SQLString &in)

Inserts a SQLString(p. 167) into a stream, quoted and escaped.

template<> ostream & operator<< (quote_type1 o, const string &in)

Inserts a C++ string into a stream, quoted and escaped.


template<> ostream & operator<< (quote_type1 o, const char const
&in)

Inserts a C string into a stream, quoted and escaped.


template<class Str> ostream & _manip (quote_type1 o, const ColData_Tmpl< Str > &in)

Utility function used by operator<<(quote_type1, ColData).


template<> ostream & operator<< (quote_type1 o, const ColData_Tmpl< string > &in)

Inserts a ColData into a stream, quoted and escaped.


template<> ostream & operator<< (quote_type1 o, const ColData_Tmpl< const_string > &in)

Inserts a ColData with const string into a stream, quoted and escaped.
ostream & operator<< (ostream &o, const ColData_Tmpl< string >
&in)

Inserts a ColData into a stream.


ostream & operator<< (ostream &o, const ColData_Tmpl< const_string > &in)

Inserts a ColData with const string into a stream.


Query & operator<< (Query &o, const ColData_Tmpl< string >
&in)

Insert a ColData into a SQLQuery.


Query & operator<< (Query &o, const ColData_Tmpl< const_string > &in)

Insert a ColData with const string into a SQLQuery.


SQLQueryParms & operator<< (quote_only_type2 p, SQLString
&in)

Inserts a SQLString(p. 167) into a stream, quoting it unless it's data that
needs no quoting.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

20

MySQL++ Namespace Documentation


template<> ostream & operator<< (quote_only_type1 o, const ColData_Tmpl< string > &in)

Inserts a ColData into a stream, quoted.

template<> ostream & operator<< (quote_only_type1 o, const ColData_Tmpl< const_string > &in)

Inserts a ColData with const string into a stream, quoted.

SQLQueryParms & operator<< (quote_double_only_type2 p, SQLString &in)

Inserts a SQLString(p. 167) into a stream, double-quoting it (") unless it's


data that needs no quoting.

template<> ostream & operator<< (quote_double_only_type1 o,


const ColData_Tmpl< string > &in)

Inserts a ColData into a stream, double-quoted (").

template<> ostream & operator<< (quote_double_only_type1 o,


const ColData_Tmpl< const_string > &in)

Inserts a ColData with const string into a stream, double-quoted (").

SQLQueryParms & operator<< (escape_type2 p, SQLString &in)

Inserts a SQLString(p. 167) into a stream, escaping special SQL characters.

template<> std::ostream & operator<< (escape_type1 o, const


std::string &in)

Inserts a C++ string into a stream, escaping special SQL characters.


template<> ostream & operator<< (escape_type1 o, const char const
&in)

Inserts a C string into a stream, escaping special SQL characters.


template<class Str> ostream & _manip (escape_type1 o, const ColData_Tmpl< Str > &in)

Utility function used by operator<<(escape_type1, ColData).

template<> std::ostream & operator<< (escape_type1 o, const ColData_Tmpl< std::string > &in)

Inserts a ColData into a stream, escaping special SQL characters.

template<> std::ostream & operator<< (escape_type1 o, const ColData_Tmpl< const_string > &in)

Inserts a ColData with const string into a stream, escaping special SQL characters.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

21

SQLQueryParms & operator<< (do_nothing_type2 p, SQLString


&in)

Inserts a SQLString(p. 167) into a stream, with no escaping or quoting.


SQLQueryParms & operator<< (ignore_type2 p, SQLString &in)

Inserts a SQLString(p. 167) into a stream, with no escaping or quoting, and


without marking the string as having been "processed".
template<class T> std::ostream & operator<< (escape_type1 o, const
T &in)

Inserts any type T into a stream that has an operator<< dened for it.
template<> std::ostream & operator<< (escape_type1 o, char const
&in)

Inserts a C string into a stream, escaping special SQL characters.


std::ostream & operator<< (escape_type1 o, char in[ ])

Inserts an array of char into a stream, escaping special SQL characters.


template<class Container> std::ostream & operator<< (std::ostream
&s, const Set< Container > &d)

Inserts a Set(p. 161) object into a C++ stream.


unsigned int get_library_version ()

Get the current MySQL++ library version number.


template<class Type, class Behavior> std::ostream & operator<<
(std::ostream &o, const Null< Type, Behavior > &n)

Inserts null-able data into a C++ stream if it is not actually null. Otherwise,
insert something appropriate for null data.
void swap (ResUse &x, ResUse &y)

Swaps two ResUse(p. 142) objects.


void swap (Result &x, Result &y)

Swaps two Result(p. 140) objects.


template<class Strng, class T> Strng stream2string (const T &object)

Converts a stream-able object to any type that can be initialized from an


std::string.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

22

MySQL++ Namespace Documentation


void strip (std::string &s)

Strips blanks at left and right ends.


void escape_string (std::string &s)

C++ equivalent of mysql_escape_string().


void str_to_upr (std::string &s)

Changes case of string to upper.


void str_to_lwr (std::string &s)

Changes case of string to lower.


void strip_all_blanks (std::string &s)

Removes all blanks.


void strip_all_non_num (std::string &s)

Removes all non-numerics.


bool operator== (const mysql_type_info &a, const mysql_type_info &b)

Returns true if two mysql_type_info(p. 103) objects are equal.


bool operator!= (const mysql_type_info &a, const mysql_type_info &b)

Returns true if two mysql_type_info(p. 103) objects are not equal.


bool operator== (const std::type_info &a, const mysql_type_info
&b)

Returns true if a given mysql_type_info(p. 103) object is equal to a given


C++ type_info object.
bool operator!= (const std::type_info &a, const mysql_type_info
&b)

Returns true if a given mysql_type_info(p. 103) object is not equal to a


given C++ type_info object.
bool operator== (const mysql_type_info &a, const std::type_info
&b)

Returns true if a given mysql_type_info(p. 103) object is equal to a given


C++ type_info object.
bool operator!= (const mysql_type_info &a, const std::type_info
&b)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

23

Returns true if a given mysql_type_info(p. 103) object is not equal to a


given C++ type_info object.
void create_vector (size_t size, std::vector< bool > &v, bool t0, bool
t1, bool t2, bool t3, bool t4, bool t5, bool t6, bool t7, bool t8, bool t9,
bool ta, bool tb, bool tc)

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


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

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


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

Inserts an equal_list_ba(p. 91) into an std::ostream.

template<class Seq1, class Seq2, class Manip> std::ostream &


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

Same as operator<< for equal_list_ba(p. 91), plus the option to suppress


insertion of some list items in the stream.

template<class Seq, class Manip> std::ostream & operator<<


(std::ostream &o, const value_list_ba< Seq, Manip > &cl)

Inserts a value_list_ba(p. 183) into an std::ostream.

template<class Seq, class Manip> std::ostream & operator<<


(std::ostream &o, const value_list_b< Seq, Manip > &cl)

Same as operator<< for value_list_ba(p. 183), plus the option to suppress


insertion of some list items in the stream.

template<class Seq> value_list_ba< Seq, do_nothing_type0 >


value_list (const Seq &s, const char d=",")

Constructs a value_list_ba(p. 183).

template<class Seq, class Manip> value_list_ba< Seq, Manip >


value_list (const Seq &s, const char d, Manip m)

Constructs a value_list_ba(p. 183).

template<class Seq, class Manip> value_list_b< Seq, Manip >


value_list (const Seq &s, const char d, Manip m, const std::vector<
bool > &vb)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

24

MySQL++ Namespace Documentation


Constructs a value_list_b(p. 181) (sparse value list).
template<class Seq, class Manip> value_list_b< Seq, Manip >
value_list (const Seq &s, const char d, Manip m, bool t0, bool t1=false,
bool t2=false, bool t3=false, bool t4=false, bool t5=false, bool t6=false,
bool t7=false, bool t8=false, bool t9=false, bool ta=false, bool tb=false,
bool tc=false)

Constructs a value_list_b(p. 181) (sparse value list).


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

Constructs a sparse value list.


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

Constructs a sparse value list.


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

Constructs an equal_list_ba(p. 91).


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

Constructs an equal_list_ba(p. 91).


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

Constructs a equal_list_b(p. 89) (sparse equal list).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

25

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

Constructs a equal_list_b(p. 89) (sparse equal list).

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

Constructs a equal_list_b(p. 89) (sparse equal list).

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

Constructs a equal_list_b(p. 89) (sparse equal list).

Variables
bool dont_quote_auto = false

Set(p. 161) to true if you want to suppress automatic quoting.

const null_type null = null_type()

Global 'null' instance. Use wherever you need a SQL null. (As opposed to a
C++ language null pointer or null character.).

6.1.1 Detailed Description


All global symbols in MySQL++ are in namespace mysqlpp. This is needed
because many symbols are rather generic (e.g. Row(p. 148), Query(p. 121)...),
so there is a serious danger of conicts.

6.1.2 Enumeration Type Documentation


[Link]

enum mysqlpp::do_nothing_type0

The 'do_nothing' manipulator.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

26

MySQL++ Namespace Documentation

Does exactly what it says: nothing. Used as a dummy manipulator when you
are required to use some manipulator but don't want anything to be done to
the following item. When used with SQLQueryParms(p. 164) it will make
sure that it does not get formatted in any way, overriding any setting set by the
template query.

Enumeration values:

do_nothing
item

[Link]

insert into a std::ostream to override manipulation of next

enum mysqlpp::escape_type0

The 'escape' manipulator.


Calls mysql_escape_string() in the MySQL C API on the following argument
to prevent any special SQL characters from being interpreted.

[Link]

enum mysqlpp::ignore_type0

The 'ignore' manipulator.


Only valid when used with SQLQueryParms(p. 164). It's a dummy manipulator like the do_nothing manipulator, except that it will not override formatting set by the template query. It is simply ignored.

Enumeration values:

ignore

[Link]

insert into a std::ostream as a dummy manipulator

enum mysqlpp::quote_double_only_type0

The 'double_quote_only' manipulator.


Similar to quote_only manipulator, except that it uses double quotes instead
of single quotes.

Enumeration values:

quote_double_only

[Link]

insert into a std::ostream to double-quote next item

enum mysqlpp::quote_only_type0

The 'quote_only' manipulator.


Similar to quote manipulator, except that it doesn't escape special SQL characters.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

27

Enumeration values:

quote_only

[Link]

insert into a std::ostream to single-quote next item

enum mysqlpp::quote_type0

The standard 'quote' manipulator.


Insert this into a stream to put single quotes around the next item in the stream,
and escape characters within it that are 'special' in SQL. This is the most
generally useful of the manipulators.

Enumeration values:

quote

insert into a std::ostream to single-quote and escape next item

6.1.3 Function Documentation


[Link]

template<class Container> void mysqlpp::create_vector


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

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


This function is used with the ResUse(p. 142) and Result(p. 140) containers,
which have a eld_num() member function that maps a eld name to its position number. So for each named eld, we set the bool in the vector at the
corresponding position to true.
This function is used within the library to build the vector used in calling the
vector form of Row::equal_list()(p. 152), Row::value_list()(p. 159), and
Row::eld_list()(p. 155). See the "Harnessing SSQLS Internals" section of
the user manual to see that feature at work.

[Link]

void mysqlpp::create_vector (size_t size, std::vector< bool


> & v, bool t0, bool t1 = false, bool t2 = false, bool t3 =
false, bool t4 = false, bool t5 = false, bool t6 = false, bool
t7 = false, bool t8 = false, bool t9 = false, bool ta = false,
bool tb = false, bool tc = false)

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


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

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

28

MySQL++ Namespace Documentation

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

[Link]

template<class Seq1, class Seq2> equal_list_b<Seq1, Seq2,


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

[Link]

template<class Seq1, class Seq2> equal_list_b<Seq1, Seq2,


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

[Link]

template<class Seq1, class Seq2> equal_list_b<Seq1, Seq2,


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

29

inserted into a stream.

[Link]

template<class Seq1, class Seq2, class Manip>


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

[Link]

template<class Seq1, class Seq2, class Manip>


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

Constructs a equal_list_b(p. 89) (sparse equal list).


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

[Link]

template<class Seq1, class Seq2, class Manip>


equal_list_ba<Seq1, Seq2, Manip> equal_list (const Seq1
& s1, const Seq2 & s2, const char d, const char e, Manip
m)

Constructs an equal_list_ba(p. 91).


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

[Link]

template<class Seq1, class Seq2> equal_list_ba<Seq1,


Seq2, do_nothing_type0> equal_list (const Seq1 & s1,
const Seq2 & s2, const char d = ",", const char e = " =
")

Constructs an equal_list_ba(p. 91).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

30

MySQL++ Namespace Documentation

This function returns an equal list that uses the 'do_nothing' manipulator.
That is, the items are not quoted or escaped in any way when inserted into a
stream. See equal_list(Seq, Seq, const char, const char, Manip) if you need
a dierent manipulator.
The idea is for both lists to be of equal length because corresponding elements
from each list are handled as pairs, but if one list is shorter than the other, the
generated list will have that many elements.

Parameters:

s1

items on the left side of the equals sign when the equal list is inserted
into a stream
s2 items on the right side of the equals sign
d delimiter operator<< should place between pairs
e what operator<< should place between items in each pair; by default,
an equals sign, as that is the primary use for this mechanism.

[Link]

MYSQLPP_EXPORT unsigned int


mysqlpp::get_library_version ()

Get the current MySQL++ library version number.


MySQL++ version number that the program is actually linked to, encoded
by MYSQLPP_VERSION macro. Compare this value to the MYSQLPP_HEADER_VERSION constant in order to ensure that your program is using
header les from the same version of MySQL++ as the actual library you're
linking to.

[Link]

template<class Seq, class Manip> std::ostream&


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

Same as operator<< for value_list_ba(p. 183), plus the option to suppress


insertion of some list items in the stream.
See value_list_b's documentation for examples of how this works.

[Link]

template<class Seq, class Manip> std::ostream&


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

Inserts a value_list_ba(p. 183) into an std::ostream.


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

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

31

See value_list_ba's documentation for concrete examples.

See also:
value_list()(p. 38)
[Link]

template<class Seq1, class Seq2, class Manip>


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

Same as operator<< for equal_list_ba(p. 91), plus the option to suppress


insertion of some list items in the stream.
See equal_list_b's documentation for examples of how this works.

[Link]

template<class Seq1, class Seq2, class Manip>


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

Inserts an equal_list_ba(p. 91) into an std::ostream.


Given two lists (a, b) and (c, d), a delimiter D, and an equals symbol E, this
operator will insert "aEcDbEd" into the stream.
See equal_list_ba's documentation for concrete examples.

See also:
equal_list()(p. 29)
[Link]

template<> std::ostream& operator<< (escape_type1 o,


char const & in) [inline]

Inserts a C string into a stream, escaping special SQL characters.


This version exists solely to handle constness problems. We force everything to
the completely-const version: operator<<(escape_type1, const char const&).

[Link]

template<class T> std::ostream& operator<<


(escape_type1 o, const T & in) [inline]

Inserts any type T into a stream that has an operator<< dened for it.
Does not actually escape that data! Use one of the other forms of operator<<
for the escape manipulator if you need escaping. This template exists to catch

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

32

MySQL++ Namespace Documentation

cases like inserting an int after the escape manipulator: you don't actually
want escaping in this instance.

[Link]

template<> MYSQLPP_EXPORT std::ostream


& mysqlpp::operator<< (escape_type1 o, const
ColData_Tmpl< const_string > & in)

Inserts a ColData with const string into a stream, escaping special SQL characters.
Because ColData was designed to contain MySQL type data, we may choose
not to escape the data, if it is not needed.

[Link]

template<> MYSQLPP_EXPORT std::ostream


& mysqlpp::operator<< (escape_type1 o, const
ColData_Tmpl< std::string > & in)

Inserts a ColData into a stream, escaping special SQL characters.


Because ColData was designed to contain MySQL type data, we may choose
not to escape the data, if it is not needed.

[Link]

template<> MYSQLPP_EXPORT std::ostream &


mysqlpp::operator<< (escape_type1 o, const char const
& in)

Inserts a C string into a stream, escaping special SQL characters.


Because C's type system lacks the information we need to second- guess this
manipulator, we always run the escaping algorithm on the data, even if it's not
needed.

[Link]

template<> MYSQLPP_EXPORT std::ostream &


mysqlpp::operator<< (escape_type1 o, const std::string &
in)

Inserts a C++ string into a stream, escaping special SQL characters.


Because std::string lacks the type information we need, the string is always
escaped, even if it doesn't need it.

[Link]

MYSQLPP_EXPORT SQLQueryParms &


mysqlpp::operator<< (escape_type2 p, SQLString & in)

Inserts a SQLString(p. 167) into a stream, escaping special SQL characters.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

33

We actually only do the escaping if in.is_string is set but in.dont_escape is not.


If that is not the case, we insert the string data directly.

[Link]

template<> ostream& operator<< (quote_double_only_type1 o, const ColData_Tmpl< const_string > &


in)

Inserts a ColData with const string into a stream, double-quoted (").


Because ColData was designed to contain MySQL type data, we may choose
not to actually quote the data, if it is not needed.

[Link]

template<> ostream& operator<< (quote_double_only_type1 o, const ColData_Tmpl< string > &


in)

Inserts a ColData into a stream, double-quoted (").


Because ColData was designed to contain MySQL type data, we may choose
not to actually quote the data, if it is not needed.

[Link]

SQLQueryParms& operator<< (quote_double_only_type2 p, SQLString &


in)

Inserts a SQLString(p. 167) into a stream, double-quoting it (") unless it's


data that needs no quoting.
We make the decision to quote the data based on the in.is_string ag. You can
set it yourself, but SQLString's ctors should set it correctly for you.

[Link]

template<> ostream& operator<< (quote_only_type1 o,


const ColData_Tmpl< const_string > & in)

Inserts a ColData with const string into a stream, quoted.


Because ColData was designed to contain MySQL type data, we may choose
not to actually quote the data, if it is not needed.

[Link]

template<> ostream& operator<< (quote_only_type1 o,


const ColData_Tmpl< string > & in)

Inserts a ColData into a stream, quoted.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

34

MySQL++ Namespace Documentation

Because ColData was designed to contain MySQL type data, we may choose
not to actually quote the data, if it is not needed.

[Link]

SQLQueryParms& operator<< (quote_only_type2 p,


SQLString & in)

Inserts a SQLString(p. 167) into a stream, quoting it unless it's data that needs
no quoting.
We make the decision to quote the data based on the in.is_string ag. You can
set it yourself, but SQLString's ctors should set it correctly for you.

[Link]

Query& operator<< (Query & o, const ColData_Tmpl<


const_string > & in)

Insert a ColData with const string into a SQLQuery.


This operator appears to be a workaround for a weakness in one compiler's
implementation of the C++ type system. See Wishlist for current plan on what
to do about this.

[Link]

Query& operator<< (Query & o, const ColData_Tmpl<


string > & in)

Insert a ColData into a SQLQuery.


This operator appears to be a workaround for a weakness in one compiler's
implementation of the C++ type system. See Wishlist for current plan on what
to do about this.

[Link]

ostream& operator<< (ostream & o, const


ColData_Tmpl< const_string > & in)

Inserts a ColData with const string into a stream.


Because ColData was designed to contain MySQL type data, this operator has
the information needed to choose to quote and/or escape the data as it is inserted into the stream, even if you don't use any of the quoting or escaping
manipulators.

[Link]

ostream& operator<< (ostream & o, const


ColData_Tmpl< string > & in)

Inserts a ColData into a stream.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

35

Because ColData was designed to contain MySQL type data, this operator has
the information needed to choose to quote and/or escape the data as it is inserted into the stream, even if you don't use any of the quoting or escaping
manipulators.

[Link]

template<> ostream& operator<< (quote_type1 o, const


ColData_Tmpl< const_string > & in)

Inserts a ColData with const string into a stream, quoted and escaped.
Because ColData was designed to contain MySQL type data, we may choose
not to actually quote or escape the data, if it is not needed.

[Link]

template<> ostream& operator<< (quote_type1 o, const


ColData_Tmpl< string > & in)

Inserts a ColData into a stream, quoted and escaped.


Because ColData was designed to contain MySQL type data, we may choose
not to actually quote or escape the data, if it is not needed.

[Link]

template<> ostream& operator<< (quote_type1 o, const


char const & in)

Inserts a C string into a stream, quoted and escaped.


Because C strings lack the type information we need, the string is both quoted
and escaped, always.

[Link]

template<> ostream& operator<< (quote_type1 o, const


string & in)

Inserts a C++ string into a stream, quoted and escaped.


Because std::string lacks the type information we need, the string is both quoted
and escaped, always.

[Link]

SQLQueryParms& operator<< (quote_type2 p,


SQLString & in)

Inserts a SQLString(p. 167) into a stream, quoted and escaped.


If in.is_string is set and in.dont_escape is not set, the string is quoted and
escaped.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

36

MySQL++ Namespace Documentation

If both in.is_string and in.dont_escape are set, the string is quoted but not
escaped.
If in.is_string is not set, the data is inserted as-is. This is the case when you
initialize SQLString(p. 167) with one of the constructors taking an integral
type, for instance.

[Link]

MYSQLPP_EXPORT std::ostream &


mysqlpp::operator<< (std::ostream & os, const DateTime
& dt)

Inserts a DateTime(p. 81) object into a C++ stream in a MySQL-compatible


format.
The date and time are inserted into the stream, in that order, with a space
between them.

Parameters:

os stream to insert date and time into


dt date/time object to insert into stream

[Link]

MYSQLPP_EXPORT std::ostream &


mysqlpp::operator<< (std::ostream & os, const Time & t)

Inserts a Time(p. 173) object into a C++ stream in a MySQL-compatible format.


The format is HH:MM:SS, zero-padded.

Parameters:

os stream to insert time into


t time to insert into stream

[Link]

MYSQLPP_EXPORT std::ostream &


mysqlpp::operator<< (std::ostream & os, const Date & d)

Inserts a Date(p. 78) object into a C++ stream.


The format is YYYY-MM-DD, zero-padded.

Parameters:

os stream to insert date into


d date to insert into stream

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference


[Link]

37

template<class Strng, class T> Strng stream2string (const


T & object)

Converts a stream-able object to any type that can be initialized from an


std::string.
This adapter takes any object that has an out_stream() member function and
converts it to a string type. An example of such a type within the library is
mysqlpp::Date(p. 78).

[Link]

template<class Seq> value_list_b<Seq,


do_nothing_type0> value_list (const Seq & s,
bool t1 = false, bool t2 = false, bool t3 = false,
false, bool t5 = false, bool t6 = false, bool t7 =
t8 = false, bool t9 = false, bool ta = false, bool
bool tc = false)

bool t0,
bool t4 =
false, bool
tb = false,

Constructs a sparse value list.


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

[Link]

template<class Seq> value_list_b<Seq,


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

Constructs a sparse value list.


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

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

38

MySQL++ Namespace Documentation

[Link]

template<class Seq, class Manip> value_list_b<Seq,


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

Constructs a value_list_b(p. 181) (sparse value list).


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

[Link]

template<class Seq, class Manip> value_list_b<Seq,


Manip> value_list (const Seq & s, const char d, Manip
m, const std::vector< bool > & vb) [inline]

Constructs a value_list_b(p. 181) (sparse value list).

Parameters:

s an STL sequence of items in the value list


d delimiter operator<< should place between items
m manipulator to use when inserting items into a stream
vb for each item in this vector that is true, the corresponding item in the
value list is inserted into a stream; the others are suppressed

[Link]

template<class Seq, class Manip> value_list_ba<Seq,


Manip> value_list (const Seq & s, const char d, Manip
m)

Constructs a value_list_ba(p. 183).

Parameters:

s an STL sequence of items in the value list


d delimiter operator<< should place between items
m manipulator to use when inserting items into a stream

[Link]

template<class Seq> value_list_ba<Seq,


do_nothing_type0> value_list (const Seq & s, const char
d = ",")

Constructs a value_list_ba(p. 183).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

6.1 mysqlpp Namespace Reference

39

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

Parameters:

s an STL sequence of items in the value list


d delimiter operator<< should place between items

6.1.4 Variable Documentation


[Link]

bool mysqlpp::dont_quote_auto = false

Set(p. 161) to true if you want to suppress automatic quoting.


Works only for ColData inserted into C++ streams.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

40

MySQL++ Namespace Documentation

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 7

MySQL++ Class
Documentation
7.1 AutoFlag< T > Class Template Reference
A template for setting a ag on a variable as long as the object that set it is in
scope. Flag resets when object goes out of scope. Works on anything that looks
like bool.

#include <autoflag.h>
Collaboration diagram for AutoFlag< T >:

Public Member Functions


AutoFlag (T &ref)

Constructor: sets ref to true.

AutoFlag ()

Destructor: sets referent passed to ctor to false.

7.1.1 Detailed Description


template<class T = bool> class AutoFlag< T >
A template for setting a ag on a variable as long as the object that set it is in
scope. Flag resets when object goes out of scope. Works on anything that looks
like bool.

42

MySQL++ Class Documentation

The documentation for this class was generated from the following le:
autoag.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.2 mysqlpp::BadConversion Class Reference

43

7.2 mysqlpp::BadConversion Class Reference


Exception(p. 93) thrown when a bad type conversion is attempted.
#include <exceptions.h>
Inheritance diagram for mysqlpp::BadConversion:Collaboration diagram for
mysqlpp::BadConversion:

Public Member Functions


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

Create exception object, building error string dynamically.


BadConversion (const std::string &w, const char tn, const char d,
size_t r, size_t a)

Create exception object, given completed error string.


BadConversion (const char w="")

Create exception object, with error string only.


BadConversion () throw ()

Destroy exception.

Public Attributes
const char type_name

name of type we tried to convert to


std::string data

string form of data we tried to convert


size_t retrieved

documentation needed!
size_t actual_size

documentation needed!

7.2.1 Detailed Description


Exception(p. 93) thrown when a bad type conversion is attempted.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

44

MySQL++ Class Documentation

7.2.2 Constructor & Destructor Documentation


[Link]

mysqlpp::BadConversion::BadConversion (const char tn,


const char d, size_t r, size_t a) [inline]

Create exception object, building error string dynamically.

Parameters:

tn type name we tried to convert to


d string form of data we tried to convert
r ??
a ??

[Link]

mysqlpp::BadConversion::BadConversion (const std::string


& w, const char tn, const char d, size_t r, size_t a)
[inline]

Create exception object, given completed error string.

Parameters:

w the "what" error string


tn type name we tried to convert to
d string form of data we tried to convert
r ??
a ??

[Link]

mysqlpp::BadConversion::BadConversion (const char w =


"") [inline, explicit]

Create exception object, with error string only.

Parameters:

the "what" error string

All other data members are initialize to default values


The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.3 mysqlpp::BadFieldName Class Reference

45

7.3 mysqlpp::BadFieldName Class Reference


Exception(p. 93) thrown when a requested named eld doesn't exist.
#include <exceptions.h>
Inheritance diagram for mysqlpp::BadFieldName:Collaboration diagram for
mysqlpp::BadFieldName:

Public Member Functions


BadFieldName (const char bad_eld)

Create exception object.


BadFieldName () throw ()

Destroy exception.

7.3.1 Detailed Description


Exception(p. 93) thrown when a requested named eld doesn't exist.
Thrown by Row::lookup_by_name() when you pass a eld name that isn't in
the result set.

7.3.2 Constructor & Destructor Documentation


[Link]

mysqlpp::BadFieldName::BadFieldName (const char


bad_eld) [inline, explicit]

Create exception object.

Parameters:

bad_eld

name of eld the MySQL server didn't like

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

46

MySQL++ Class Documentation

7.4 mysqlpp::BadNullConversion Class Reference


Exception(p. 93) thrown when you attempt to convert a SQL null to an incompatible type.

#include <exceptions.h>
Inheritance diagram for mysqlpp::BadNullConversion:Collaboration diagram for
mysqlpp::BadNullConversion:

Public Member Functions


BadNullConversion (const char w="")

Create exception object.

7.4.1 Detailed Description


Exception(p. 93) thrown when you attempt to convert a SQL null to an incompatible type.

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.5 mysqlpp::BadOption Class Reference

47

7.5 mysqlpp::BadOption Class Reference


Exception(p. 93) thrown when you pass an unrecognized option to
Connection::set_option()(p. 69).
#include <exceptions.h>
Inheritance diagram for mysqlpp::BadOption:Collaboration diagram for
mysqlpp::BadOption:

Public Member Functions


BadOption (const char w, Connection::Option o)

Create exception object, taking C string.


BadOption (const std::string &w, Connection::Option o)

Create exception object, taking C++ string.


Connection::Option what_option () const

Return the option that failed.

7.5.1 Detailed Description


Exception(p. 93) thrown when you pass an unrecognized option to
Connection::set_option()(p. 69).
The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

48

MySQL++ Class Documentation

7.6 mysqlpp::BadParamCount Class Reference


Exception(p. 93) thrown when not enough query parameters are provided.
#include <exceptions.h>
Inheritance diagram for mysqlpp::BadParamCount:Collaboration diagram for
mysqlpp::BadParamCount:

Public Member Functions


BadParamCount (const char w="")

Create exception object.


BadParamCount () throw ()

Destroy exception.

7.6.1 Detailed Description


Exception(p. 93) thrown when not enough query parameters are provided.
This is used in handling template queries.
The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.7 mysqlpp::BadQuery Class Reference

49

7.7 mysqlpp::BadQuery Class Reference


Exception(p. 93) thrown when MySQL encounters a problem while processing
your query.

#include <exceptions.h>
Inheritance diagram
mysqlpp::BadQuery:

for

mysqlpp::BadQuery:Collaboration

diagram

for

Public Member Functions


BadQuery (const char w="")

Create exception object, taking C string.


BadQuery (const std::string &w)

Create exception object, taking C++ string.

7.7.1 Detailed Description


Exception(p. 93) thrown when MySQL encounters a problem while processing
your query.

This exception is typically only thrown when the server rejects a SQL query.
In v1.7, it was used as a more generic exception type, for no particularly good
reason.
The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

50

MySQL++ Class Documentation

7.8 mysqlpp::BasicLock Class Reference


Trivial Lock(p. 99) subclass, using a boolean variable as the lock ag.

#include <lockable.h>
Inheritance diagram
mysqlpp::BasicLock:

for

mysqlpp::BasicLock:Collaboration

diagram

for

Public Member Functions


BasicLock (bool is_locked=false)

Create object.
BasicLock ()

Destroy object.
bool lock ()

Lock(p. 99) the object.


void unlock ()

Unlock the object.


bool locked () const

Returns true if object is locked.


void set (bool b)

Set(p. 161) the lock state.

7.8.1 Detailed Description


Trivial Lock(p. 99) subclass, using a boolean variable as the lock ag.
This is the only Lock(p. 99) implementation available in this version of MySQL++. It will be supplemented with a better implementation for use with
threads at a later date.

7.8.2 Member Function Documentation


[Link]

bool mysqlpp::BasicLock::lock () [inline, virtual]

Lock(p. 99) the object.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.8 mysqlpp::BasicLock Class Reference


Returns:

true if object was already locked

Implements mysqlpp::Lock (p. 99).


The documentation for this class was generated from the following le:
lockable.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

51

52

MySQL++ Class Documentation

7.9 mysqlpp::ColData_Tmpl< Str > Class Template Reference


Template for string data that can convert itself to any standard C data type.

#include <coldata.h>
Collaboration diagram for mysqlpp::ColData_Tmpl< Str >:

Public Member Functions


ColData_Tmpl ()

Default constructor.
ColData_Tmpl (const ColData_Tmpl< Str > &cd)

Copy ctor.
ColData_Tmpl (bool n,
info::string_type)

mysql_type_info t=mysql_type_-

Constructor allowing you to set the null ag and the type data.
ColData_Tmpl (const std::string &str,
mysql_type_info
t=mysql_type_info::string_type, bool n=false)

C++ string version of full ctor.


ColData_Tmpl (const char str, mysql_type_info t=mysql_type_info::string_type, bool n=false)

Null-terminated C string version of full ctor.


ColData_Tmpl (const char str, typename Str::size_type len,
mysql_type_info
t=mysql_type_info::string_type,
bool
n=false)

Full constructor.
mysql_type_info type () const

Get this object's current MySQL type.


bool quote_q () const

Returns true if data of this type should be quoted, false otherwise.


bool escape_q () const

Returns true if data of this type should be escaped, false otherwise.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.9 mysqlpp::ColData_Tmpl< Str > Class Template Reference

53

template<class Type> Type conv (Type dummy) const

Template for converting data from one type to another.


void it_is_null ()

Set(p. 161) a ag indicating that this object is a SQL null.

const bool is_null () const

Returns true if this object is a SQL null.


const std::string & get_string () const

Returns this object's data in C++ string form.


operator cchar () const

Returns a const char pointer to the object's raw data.


operator signed char () const

Converts this object's string data to a signed char.


operator unsigned char () const

Converts this object's string data to an unsigned char.


operator int () const

Converts this object's string data to an int.


operator unsigned int () const

Converts this object's string data to an unsigned int.


operator short int () const

Converts this object's string data to a short int.


operator unsigned short int () const

Converts this object's string data to an unsigned short int.


operator long int () const

Converts this object's string data to a long int.


operator unsigned long int () const

Converts this object's string data to an unsigned long int.


operator longlong () const

Converts this object's string data to the platform- specic 'longlong' type,
usually a 64-bit integer.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

54

MySQL++ Class Documentation


operator ulonglong () const

Converts this object's string data to the platform- specic 'ulonglong' type,
usually a 64-bit unsigned integer.
operator oat () const

Converts this object's string data to a oat.


operator double () const

Converts this object's string data to a double.


operator bool () const

Converts this object's string data to a bool.


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

Converts this object to a SQL null.

7.9.1 Detailed Description


template<class Str> class mysqlpp::ColData_Tmpl< Str >
Template for string data that can convert itself to any standard C data type.
Do not use this class directly. Use the typedef ColData or MutableColData instead. ColData is a ColData_Tmpl(p. 52)<const std::string> and
MutableColData is a ColData_Tmpl<std::string>(p. 55).
The ColData types add to the C++ string type the ability to automatically
convert the string data to any of the basic C types. This is important with
SQL, because all data coming from the database is in string form. MySQL++
uses this class internally to hold the data it receives from the server, so you can
use it naturally, because it does the conversions implicitly:
ColData("12.86") + 2.0

That works ne, but be careful. If you had said this instead:
ColData("12.86") + 2

the result would be 14 because 2 is an integer, and C++'s type conversion rules
put the ColData object in an integer context.
If these automatic conversions scare you, dene the macro NO_BINARY_OPERS to disable this behavior.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.9 mysqlpp::ColData_Tmpl< Str > Class Template Reference

55

This class also has some basic information about the type of data stored in it, to
allow it to do the conversions more intelligently than a trivial implementation
would allow.

7.9.2 Constructor & Destructor Documentation


[Link]

template<class Str> mysqlpp::ColData_Tmpl< Str


>::ColData_Tmpl () [inline]

Default constructor.

Null(p. 110) ag is set to false, type data is not set, and string data is left
empty.

It's probably a bad idea to use this ctor, becuase there's no way to set the type
data once the object's constructed.

[Link]

template<class Str> mysqlpp::ColData_Tmpl< Str


>::ColData_Tmpl (const ColData_Tmpl< Str > & cd)
[inline]

Copy ctor.

Parameters:

cd

[Link]

the other ColData_Tmpl(p. 52) object

template<class Str> mysqlpp::ColData_Tmpl< Str


>::ColData_Tmpl (bool n, mysql_type_info t =
mysql_type_info::string_type) [inline, explicit]

Constructor allowing you to set the null ag and the type data.

Parameters:

n if true, data is a SQL null


t MySQL type information for data being stored

[Link]

template<class Str> mysqlpp::ColData_Tmpl<


Str >::ColData_Tmpl (const std::string & str,
mysql_type_info t = mysql_type_info::string_type, bool
n = false) [inline, explicit]

C++ string version of full ctor.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

56

MySQL++ Class Documentation

Parameters:

str the string this object represents


t MySQL type information for data within str
n if true, str is a SQL null

[Link]

template<class Str> mysqlpp::ColData_Tmpl< Str


>::ColData_Tmpl (const char str, mysql_type_info t =
mysql_type_info::string_type, bool n = false) [inline,
explicit]

Null-terminated C string version of full ctor.

Parameters:

str the string this object represents


t MySQL type information for data within str
n if true, str is a SQL null

[Link]

template<class Str> mysqlpp::ColData_Tmpl<


Str >::ColData_Tmpl (const char str, typename
Str::size_type len, mysql_type_info t =
mysql_type_info::string_type, bool n = false) [inline,
explicit]

Full constructor.

Parameters:

str the string this object represents


len the length of the string; embedded nulls are legal
t MySQL type information for data within str
n if true, str is a SQL null

7.9.3 Member Function Documentation


[Link]

template<class Str> const std::string&


mysqlpp::ColData_Tmpl< Str >::get_string () const
[inline]

Returns this object's data in C++ string form.


This method is inecient, and not recommended. It makes a duplicate copy of
the string that lives as long as the ColData object itself.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.9 mysqlpp::ColData_Tmpl< Str > Class Template Reference

57

If you are using the MutableColData typedef for this template, you can avoid
the duplicate copy entirely. You can pass a MutableColData object to anything
expecting a std::string and get the right result. (This didn't work reliably
prior to v2.3.)
This method is arguably useful with plain ColData objects, but there are more
ecient alternatives. If you know your data is a null-terminated C string, just
cast this object to a const char or call the data() method. This gives you
a pointer to our internal buer, so the copy isn't needed. If the ColData can
contain embedded null characters, you do need to make a copy, but it's better
to make your own copy of the string, instead of calling get_string()(p. 56), so
you can better control its lifetime:
ColData cd = ...;
std::string s([Link](), [Link]());

[Link]

template<class Str> template<class T, class B>


mysqlpp::ColData_Tmpl< Str >::operator Null< T, B > ()
const

Converts this object to a SQL null.


Returns a copy of the global null object if the string data held by the object is
exactly equal to "NULL". Else, it constructs an empty object of type T and
tries to convert it to Null<T, B>.
The documentation for this class was generated from the following le:
coldata.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

58

MySQL++ Class Documentation

7.10 mysqlpp::Connection Class Reference


Manages the connection to the MySQL database.

#include <connection.h>
Inheritance diagram for mysqlpp::Connection:Collaboration diagram for
mysqlpp::Connection:

Public Types
enum OptionArgType { opt_type_none,
opt_type_integer, opt_type_boolean }

opt_type_string,

Legal types of option arguments.


enum Option {

opt_FIRST = -1, opt_connect_timeout = 0, opt_compress,


opt_named_pipe,
opt_init_command,
opt_read_default_le,
opt_read_default_group, opt_set_charset_dir,
opt_set_charset_name, opt_local_inle, opt_protocol, opt_shared_memory_base_name,
opt_read_timeout, opt_write_timeout, opt_use_result, opt_use_remote_connection,
opt_use_embedded_connection, opt_guess_connection, opt_set_client_ip, opt_secure_auth,
opt_multi_statements, opt_report_data_truncation, opt_reconnect, opt_COUNT }
Per-connection options you can set with set_option()(p. 69).

Public Member Functions


Connection (bool te=true)

Create object without connecting it to the MySQL server.


Connection (const char db, const char host="", const char user="",
const char passwd="", uint port=0, my_bool compress=0, unsigned
int connect_timeout=60, cchar socket_name=0, unsigned int client_ag=0)

Create object and connect to database server in one step.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference

59

Connection (const Connection &other)

Establish a new connection using the same parameters as an existing C API


connection.
bool connect (const MYSQL &mysql)

Establish a new connection using the same parameters as an existing C API


connection.
Connection ()

Destroy connection object.


bool connect (cchar db="", cchar host="", cchar user="", cchar
passwd="", uint port=0, my_bool compress=0, unsigned int connect_timeout=60, cchar socket_name=0, unsigned int client_ag=0)

Connect to database after object is created.


void close ()

Close connection to MySQL server.


std::string info ()

Calls MySQL C API function mysql_info() and returns result as a C++


string.
bool connected () const

return true if connection was established successfully


bool success () const

Return true if the last query was successful.


void purge ()

Alias for close()(p. 64).

Query query ()

Return a new query object.


operator bool ()

Alias for success()(p. 59).

Connection & operator= (const Connection &rhs)

Copy an existing Connection(p. 58) object's state into this object.

const char error ()

Return error message for last MySQL error associated with this connection.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

60

MySQL++ Class Documentation

int errnum ()

Return last MySQL error number associated with this connection.


int refresh (unsigned int refresh_options)

Wraps MySQL C API function mysql_refresh().


int ping ()

"Pings" the MySQL database


int kill (unsigned long pid)

Kill a MySQL server thread.


std::string client_info ()

Get MySQL client library version.


std::string host_info ()

Get information about the network connection.


int proto_info ()

Returns version number of MySQL protocol this connection is using.


std::string server_info ()

Get the MySQL server's version number.


std::string stat ()

Returns information about MySQL server status.


bool create_db (const std::string &db)

Create a database.
bool drop_db (const std::string &db)

Drop a database.
bool select_db (const std::string &db)

Change to a dierent database.


bool select_db (const char db)

Change to a dierent database.


bool reload ()

Ask MySQL server to reload the grant tables.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference

61

bool shutdown ()

Ask MySQL server to shut down.

st_mysql_options get_options () const

Return the connection options object.

bool set_option (Option option)

Sets a connection option, with no argument.

bool set_option (Option option, const char arg)

Sets a connection option, with string argument.

bool set_option (Option option, unsigned int arg)

Sets a connection option, with integer argument.

bool set_option (Option option, bool arg)

Sets a connection option, with Boolean argument.

bool set_option_default (Option option)

Same as set_option()(p. 69), except that it won't override a previously-set


option.

template<typename T> bool set_option_default (Option option, T


arg)

Same as set_option()(p. 69), except that it won't override a previously-set


option.

bool option_set (Option option)

Returns true if the given option has been set already.

void enable_ssl (const char key=0, const char cert=0, const char
ca=0, const char capath=0, const char cipher=0)

Enable SSL-encrypted connection.

my_ulonglong aected_rows ()

Return the number of rows aected by the last query.

my_ulonglong insert_id ()

Get ID generated for an AUTO_INCREMENT column in the previous INSERT query.

std::ostream & api_version (std::ostream &os)

Insert C API version we're linked against into C++ stream.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

62

MySQL++ Class Documentation

Protected Types
enum OptionError { opt_err_type, opt_err_value, opt_err_conn }

Types of option setting errors we can diagnose.

Protected Member Functions


void disconnect ()

Drop the connection to the database server.

bool bad_option (Option option, OptionError error)

Error handling routine for set_option()(p. 69).

OptionArgType option_arg_type (Option option)

Given option value, return its proper argument type.

bool set_option_impl (mysql_option moption, const void arg=0)

Set(p. 161) MySQL C API connection option.

void copy (const Connection &other)

Establish a new connection as a copy of an existing one.

Friends
class ResNSel
class ResUse
class Query

7.10.1 Detailed Description


Manages the connection to the MySQL database.

7.10.2 Member Enumeration Documentation


[Link]

enum mysqlpp::Connection::Option

Per-connection options you can set with set_option()(p. 69).


This is currently a combination of the MySQL C API mysql_option and enum_mysql_set_option enums. It may be extended in the future.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference

63

7.10.3 Constructor & Destructor Documentation


[Link]

mysqlpp::Connection::Connection (bool te = true)

Create object without connecting it to the MySQL server.

Parameters:

te

if true, exceptions are thrown on errors

[Link]

mysqlpp::Connection::Connection (const char db, const


char host = "", const char user = "", const char
passwd = "", uint port = 0, my_bool compress = 0,
unsigned int connect_timeout = 60, cchar socket_name
= 0, unsigned int client_ag = 0)

Create object and connect to database server in one step.


This constructor allows you to most fully specify the options used when connecting to the MySQL database. It is the thinnest layer in MySQL++ over
the MySQL C API function mysql_real_connect(). The correspondence isn't
exact as we have some additional parameters you'd have to set with mysql_option() when using the C API.

Parameters:

db name of database to use


host host name or IP address of MySQL server, or 0 if server is running
user

on the same host as your program

user name to log in under, or 0 to use the user name this program is
running under

passwd password to use when logging in


port TCP port number MySQL server is listening on, or 0 to use default
value

compress

if true, compress data passing through connection, to save bandwidth at the expense of CPU time

connect_timeout

max seconds to wait for server to respond to our connection attempt

socket_name

Unix domain socket server is using, if connecting to MySQL server on the same host as this program running on, or 0 to use
default name

client_ag

special connection ags. See MySQL C API documentation


for mysql_real_connect() for details.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

64

MySQL++ Class Documentation

[Link]

mysqlpp::Connection::Connection (const Connection &


other)

Establish a new connection using the same parameters as an existing C API


connection.

Parameters:

other

existing Connection(p. 58) object

7.10.4 Member Function Documentation


[Link]

my_ulonglong mysqlpp::Connection::aected_rows ()
[inline]

Return the number of rows aected by the last query.


Simply wraps mysql_affected_rows() in the C API.

[Link]

ostream & mysqlpp::Connection::api_version


(std::ostream & os)

Insert C API version we're linked against into C++ stream.


Version will be of the form X.Y.Z, where X is the major version number, Y the
minor version, and Z the bug x number.

[Link]

std::string mysqlpp::Connection::client_info () [inline]

Get MySQL client library version.


Simply wraps mysql_get_client_info() in the C API.

[Link]

void mysqlpp::Connection::close () [inline]

Close connection to MySQL server.


Closes the connection to the MySQL server.

[Link]

bool mysqlpp::Connection::connect (cchar db = "",


cchar host = "", cchar user = "", cchar passwd =
"", uint port = 0, my_bool compress = 0, unsigned
int connect_timeout = 60, cchar socket_name = 0,
unsigned int client_ag = 0)

Connect to database after object is created.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference

65

It's better to use the connect-on-create constructor if you can. See its documentation for the meaning of these parameters.
If you call this method on an object that is already connected to a database
server, the previous connection is dropped and a new connection is established.

[Link]

bool mysqlpp::Connection::connect (const MYSQL &


mysql)

Establish a new connection using the same parameters as an existing C API


connection.

Parameters:

mysql

[Link]

existing MySQL C API connection object

bool mysqlpp::Connection::connected () const [inline]

return true if connection was established successfully

Returns:

true if connection was established successfully

[Link]

void mysqlpp::Connection::copy (const Connection &


other) [protected]

Establish a new connection as a copy of an existing one.

Parameters:

other

[Link]

the connection to copy

bool mysqlpp::Connection::create_db (const std::string &


db)

Create a database.

Parameters:

db

name of database to create

Returns:

true if database was created successfully

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

66

MySQL++ Class Documentation

[Link]

void mysqlpp::Connection::disconnect () [protected]

Drop the connection to the database server.


This method is protected because it should only be used within the library.
Unless you use the default constructor, this object should always be connected.

[Link]

bool mysqlpp::Connection::drop_db (const std::string &


db)

Drop a database.

Parameters:

db

name of database to destroy

Returns:

true if database was created successfully

[Link]

void mysqlpp::Connection::enable_ssl (const char key


= 0, const char cert = 0, const char ca = 0, const
char capath = 0, const char cipher = 0)

Enable SSL-encrypted connection.


Must be called before connection is established.
Wraps mysql_ssl_set() in MySQL C API.

[Link]

int mysqlpp::Connection::errnum () [inline]

Return last MySQL error number associated with this connection.


Simply wraps mysql_errno() in the C API.

[Link]

const char mysqlpp::Connection::error () [inline]

Return error message for last MySQL error associated with this connection.
Simply wraps mysql_error() in the C API.

[Link]

std::string mysqlpp::Connection::host_info () [inline]

Get information about the network connection.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference

67

String contains info about type of connection and the server hostname.
Simply wraps mysql_get_host_info() in the C API.

[Link]

my_ulonglong mysqlpp::Connection::insert_id ()
[inline]

Get ID generated for an AUTO_INCREMENT column in the previous INSERT


query.

Return values:

if the previous query did not generate an ID. Use the SQL function
LAST_INSERT_ID() if you need the last ID generated by any query,
not just the previous one.

[Link]

int mysqlpp::Connection::kill (unsigned long pid)


[inline]

Kill a MySQL server thread.

Parameters:

pid

ID of thread to kill

Simply wraps mysql_kill() in the C API.

[Link]

mysqlpp::Connection::operator bool () [inline]

Alias for success()(p. 59).


Alias for success()(p. 59) member function. Allows you to have code constructs
like this:
Connection conn;
.... use conn
if (conn) {
... last SQL query was successful
}
else {
... error occurred in SQL query
}

[Link]

int mysqlpp::Connection::ping ()

"Pings" the MySQL database

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

68

MySQL++ Class Documentation

Wraps mysql_ping() in the C API. As a result, this function will try to reconnect to the server if the connection has been dropped.

Return values:

0 if server is responding, regardless of whether we had to reconnect or not


nonzero if either we already know the connection is down and cannot re-

establish it, or if the server did not respond to the ping and we could
not re-establish the connection.

[Link]

int mysqlpp::Connection::proto_info () [inline]

Returns version number of MySQL protocol this connection is using.


Simply wraps mysql_get_proto_info() in the C API.

[Link]

Query mysqlpp::Connection::query ()

Return a new query object.


The returned query object is tied to this MySQL connection, so when you call
a method like execute() (p. 127) on that object, the query is sent to the server
this object is connected to.

[Link]

int mysqlpp::Connection::refresh (unsigned int


refresh_options) [inline]

Wraps MySQL C API function mysql_refresh().


The corresponding C API function is undocumented. All I know is that it's
used by mysqldump and mysqladmin, according to MySQL bug database entry
[Link] If that entry changes to say that
the function is now documented, reevaluate whether we need to wrap it. It may
be that it's not supposed to be used by regular end-user programs.

[Link]

bool mysqlpp::Connection::reload ()

Ask MySQL server to reload the grant tables.


User must have the "reload" privilege.
Simply wraps mysql_reload() in the C API. Since that function is deprecated, this one is, too. The MySQL++ replacement is execute("FLUSH PRIVILEGES").

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.10 mysqlpp::Connection Class Reference


[Link]

69

std::string mysqlpp::Connection::server_info () [inline]

Get the MySQL server's version number.


Simply wraps mysql_get_server_info() in the C API.

[Link]

bool mysqlpp::Connection::set_option (Option option)

Sets a connection option, with no argument.

Parameters:

option

any of the Option enum constants

Based on the option you give, this function calls either mysql_options() or
mysql_set_server_option() in the C API.
There are several overloaded versions of this function. The others take an additional argument for the option and dier only by the type of the option. Unlike
with the underlying C API, it does matter which of these overloads you call: if
you use the wrong argument type or pass an argument where one is not expected
(or vice versa), the call will either throw an exception or return false, depending
on the object's "throw exceptions" ag.
This mechanism parallels the underlying C API structure fairly closely, but do
not expect this to continue in the future. Its very purpose is to 'paper over' the
dierences among the C API's option setting mechanisms, so it may become
further abstracted from these mechanisms.

Return values:

true

if option was successfully set, or at least queued for setting during


connection establishment sequence

If exceptions are enabled, a false return means the C API rejected the option,
or the connection is not established and so the option was queued for later
processing. If exceptions are disabled, false can also mean that the argument
was of the wrong type (wrong overload was called), the option value was out
of range, or the option is not supported by the C API, most because it isn't a
high enough version. These latter cases will cause BadOption(p. 47) exceptions
otherwise.

[Link]

bool mysqlpp::Connection::set_option_impl
(mysql_option moption, const void arg = 0)
[protected]

Set(p. 161) MySQL C API connection option.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

70

MySQL++ Class Documentation

Wraps mysql_options() in C API. This is an internal implementation detail,


to be used only by the public overloads above.

[Link]

bool mysqlpp::Connection::shutdown ()

Ask MySQL server to shut down.


User must have the "shutdown" privilege.
Simply wraps mysql_shutdown() in the C API.

[Link]

std::string mysqlpp::Connection::stat () [inline]

Returns information about MySQL server status.


String is similar to that returned by the mysqladmin status command. Among
other things, it contains uptime in seconds, and the number of running threads,
questions and open tables.
The documentation for this class was generated from the following les:
connection.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.11 mysqlpp::ConnectionFailed Class Reference

71

7.11 mysqlpp::ConnectionFailed Class Reference


Exception(p. 93) thrown when there is a problem establishing the database
server connection. It's also thrown if Connection::shutdown()(p. 70) fails.
#include <exceptions.h>
Inheritance diagram for mysqlpp::ConnectionFailed:Collaboration diagram for
mysqlpp::ConnectionFailed:

Public Member Functions


ConnectionFailed (const char w="")

Create exception object.

7.11.1 Detailed Description


Exception(p. 93) thrown when there is a problem establishing the database
server connection. It's also thrown if Connection::shutdown()(p. 70) fails.
The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

72

MySQL++ Class Documentation

7.12 mysqlpp::const_string Class Reference


Wrapper for const char to make it behave in a way more useful to MySQL++.

#include <const_string.h>

Public Types
typedef const char value_type

Type of the data stored in this object, when it is not equal to SQL null.
typedef unsigned int size_type

Type of "size" integers.


typedef const char & const_reference

Type used when returning a reference to a character in the string.


typedef const char const_iterator

Type of iterators.
typedef const_iterator iterator

Same as const_iterator because the data cannot be changed.

Public Member Functions


const_string ()

Create empty string.


const_string (const std::string &str)

Initialize string from existing C++ string.


const_string (const char str)

Initialize string from existing C string.


const_string (const char str, size_type len)

Initialize string from existing C string of known length.


const_string ()

Destroy string.
const_string & operator= (const char str)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.12 mysqlpp::const_string Class Reference

73

Assignment operator, from C string.


const_string & operator= (const const_string &cs)

Assignment operator, from other const_string(p. 72).

size_type length () const

Return number of characters in the string.

size_type size () const

Return number of characters in string.

const_iterator begin () const

Return iterator pointing to the rst character of the string.

const_iterator end () const

Return iterator pointing to one past the last character of the string.

size_type max_size () const

Return the maximum number of characters in the string.

const_reference operator[ ] (size_type pos) const

Return a reference to a character within the string.

const_reference at (size_type pos) const

Return a reference to a character within the string.

const char c_str () const

Return a const pointer to the string data. Not necessarily null-terminated!

const char data () const

Alias for c_str()(p. 73).

int compare (const const_string &str) const

Lexically compare this string to another.

7.12.1 Detailed Description


Wrapper for const char to make it behave in a way more useful to MySQL++.
This class implements a small subset of the standard string class.
As of MySQL++ 2.3, it makes a copy of the string we are initialized with,
instead of just copying the pointer. This is required to avoid problems with the
new SSQLS + BLOB support.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

74

MySQL++ Class Documentation

7.12.2 Member Function Documentation


[Link]

const_reference mysqlpp::const_string::at (size_type pos)


const [inline]

Return a reference to a character within the string.


Unlike operator[ ]()(p. 73), this function throws an std::out_of_range exception if the index isn't within range.

[Link]

int mysqlpp::const_string::compare (const const_string &


str) const [inline]

Lexically compare this string to another.

Parameters:

str

string to compare against this one

Return values:

<0 if str1 is lexically "less than" str2

if str1 is equal to str2

>0 if str1 is lexically "greater than" str2

[Link]

size_type mysqlpp::const_string::max_size () const


[inline]

Return the maximum number of characters in the string.


Because this is a const string, this is just an alias for size()(p. 73); its size is
always equal to the amount of data currently stored.
The documentation for this class was generated from the following le:
const_string.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.13 mysqlpp::const_subscript_container< OnType, ValueType,


ReturnType, SizeType, DiType > Class Template Reference
75

7.13 mysqlpp::const_subscript_container< OnType, ValueType, ReturnType, SizeType,


DiType > Class Template Reference
A base class that one derives from to become a random access container, which
can be accessed with subscript notation.

#include <resiter.h>
Inheritance diagram for mysqlpp::const_subscript_container< OnType, ValueType, ReturnType, SizeType, DiType >:

Public Types
typedef const_subscript_container< OnType, ValueType, ReturnType, SizeType, DiType > this_type

this object's type


typedef subscript_iterator< const this_type, ReturnType, SizeType,
DiType > iterator

mutable iterator type


typedef iterator const_iterator

constant iterator type


typedef const std::reverse_iterator< iterator > reverse_iterator

mutable reverse iterator type


typedef const std::reverse_iterator< const_iterator > const_-

reverse_iterator
const reverse iterator type

typedef ValueType value_type

type of data stored in container


typedef value_type & reference

reference to value_type
typedef value_type & const_reference

const ref to value_type


typedef value_type pointer

pointer to value_type

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

76

MySQL++ Class Documentation

typedef value_type const_pointer

const pointer to value_type


typedef DiType dierence_type

for index dierences


typedef SizeType size_type

for returned sizes

Public Member Functions


virtual const_subscript_container ()

Destroy object.
virtual size_type size () const=0

Return count of elements in container.


virtual ReturnType at (SizeType i) const=0

Return element at given index in container.


size_type max_size () const

Return maximum number of elements that can be stored in container without


resizing.
bool empty () const

Returns true if container is empty.


iterator begin () const

Return iterator pointing to rst element in the container.


iterator end () const

Return iterator pointing to one past the last element in the container.
reverse_iterator rbegin () const

Return reverse iterator pointing to rst element in the container.


reverse_iterator rend () const

Return reverse iterator pointing to one past the last element in the container.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.13 mysqlpp::const_subscript_container< OnType, ValueType,


ReturnType, SizeType, DiType > Class Template Reference
77

7.13.1 Detailed Description


template<class OnType, class ValueType, class ReturnType = const
ValueType&, class SizeType = unsigned int, class DiType =
int> class mysqlpp::const_subscript_container< OnType, ValueType, ReturnType, SizeType, DiType >
A base class that one derives from to become a random access container, which
can be accessed with subscript notation.
OnType must have the member functions operator[ ](SizeType) and
The documentation for this class was generated from the following le:
resiter.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

78

MySQL++ Class Documentation

7.14 mysqlpp::Date Struct Reference


C++ form of MySQL's DATE type.

#include <datetime.h>
Inheritance
diagram
mysqlpp::Date:

for

mysqlpp::Date:Collaboration

diagram

for

Public Member Functions


Date ()

Default constructor.
Date (short int y, tiny_int m, tiny_int d)

Initialize object.
Date (const Date &other)

Initialize object as a copy of another Date(p. 78).

Date (const DateTime &other)

Initialize object from date part of date/time object.


Date (cchar str)

Initialize object from a MySQL date string.


Date (const ColData &str)

Initialize object from a MySQL date string.


Date (const std::string &str)

Initialize object from a MySQL date string.


MYSQLPP_EXPORT short int compare (const Date &other) const

Compare this date to another.


MYSQLPP_EXPORT cchar convert (cchar )

Parse a MySQL date string into this object.

Public Attributes
short int year

the year

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.14 mysqlpp::Date Struct Reference

79

tiny_int month

the month, 1-12


tiny_int day

the day, 1-31

7.14.1 Detailed Description


C++ form of MySQL's DATE type.
Objects of this class can be inserted into streams, and initialized from MySQL
DATE strings.

7.14.2 Constructor & Destructor Documentation


[Link]

mysqlpp::Date::Date (cchar str) [inline]

Initialize object from a MySQL date string.


String must be in the YYYY-MM-DD format. It doesn't have to be zero-padded.

[Link]

mysqlpp::Date::Date (const ColData & str) [inline]

Initialize object from a MySQL date string.

See also:
Date(cchar)(p. 79)

[Link]

mysqlpp::Date::Date (const std::string & str) [inline]

Initialize object from a MySQL date string.

See also:
Date(cchar)(p. 79)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

80

MySQL++ Class Documentation

7.14.3 Member Function Documentation


[Link]

short int mysqlpp::Date::compare (const Date & other)


const [virtual]

Compare this date to another.


Returns < 0 if this date is before the other, 0 of they are equal, and > 0 if this
date is after the other.
Implements mysqlpp::DTbase< Date > (p. 86).

7.14.4 Member Data Documentation


[Link]

short int mysqlpp::Date::year

the year
No surprises; the year 2005 is stored as the integer 2005.
The documentation for this struct was generated from the following les:
datetime.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.15 mysqlpp::DateTime Struct Reference

81

7.15 mysqlpp::DateTime Struct Reference


C++ form of MySQL's DATETIME type.

#include <datetime.h>
Inheritance diagram
mysqlpp::DateTime:

for

mysqlpp::DateTime:Collaboration

diagram

for

Public Member Functions


DateTime ()

Default constructor.
DateTime (const DateTime &other)

Initialize object as a copy of another Date(p. 78).

DateTime (cchar str)

Initialize object from a MySQL date-and-time string.


DateTime (const ColData &str)

Initialize object from a MySQL date-and-time string.


DateTime (const std::string &str)

Initialize object from a MySQL date-and-time string.


DateTime (time_t t)

Initialize object from a time_t.


MYSQLPP_EXPORT short compare (const DateTime &other)
const

Compare this datetime to another.


MYSQLPP_EXPORT cchar convert (cchar )

Parse a MySQL date and time string into this object.


operator time_t () const

Convert to time_t.

Public Attributes
short int year

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

82

MySQL++ Class Documentation


the year
tiny_int month

the month, 1-12


tiny_int day

the day, 1-31


tiny_int hour

hour, 0-23
tiny_int minute

minute, 0-59
tiny_int second

second, 0-59

7.15.1 Detailed Description


C++ form of MySQL's DATETIME type.
Objects of this class can be inserted into streams, and initialized from MySQL
DATETIME strings.

7.15.2 Constructor & Destructor Documentation


[Link]

mysqlpp::DateTime::DateTime (cchar str) [inline]

Initialize object from a MySQL date-and-time string.


String must be in the HH:MM:SS format. It doesn't have to be zero-padded.

[Link]

mysqlpp::DateTime::DateTime (const ColData & str)


[inline]

Initialize object from a MySQL date-and-time string.

See also:
DateTime(cchar)(p. 82)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.15 mysqlpp::DateTime Struct Reference


[Link]

83

mysqlpp::DateTime::DateTime (const std::string & str)


[inline]

Initialize object from a MySQL date-and-time string.

See also:
DateTime(cchar)(p. 82)

7.15.3 Member Function Documentation


[Link]

short int mysqlpp::DateTime::compare (const DateTime &


other) const [virtual]

Compare this datetime to another.


Returns < 0 if this datetime is before the other, 0 of they are equal, and > 0 if
this datetime is after the other.
This method is protected because it is merely the engine used by the various
operators in DTbase(p. 85).
Implements mysqlpp::DTbase< DateTime > (p. 86).

7.15.4 Member Data Documentation


[Link]

short int mysqlpp::DateTime::year

the year
No surprises; the year 2005 is stored as the integer 2005.
The documentation for this struct was generated from the following les:
datetime.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

84

MySQL++ Class Documentation

7.16 mysqlpp::DBSelectionFailed Class Reference


Exception(p. 93) thrown when the program tries to select a new database and
the server refuses for some reason.

#include <exceptions.h>
Inheritance diagram for mysqlpp::DBSelectionFailed:Collaboration diagram for
mysqlpp::DBSelectionFailed:

Public Member Functions


DBSelectionFailed (const char w="")

Create exception object.

7.16.1 Detailed Description


Exception(p. 93) thrown when the program tries to select a new database and
the server refuses for some reason.

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.17 mysqlpp::DTbase< T > Struct Template Reference

7.17 mysqlpp::DTbase< T
Reference

>

85

Struct Template

Base class template for MySQL++ date and time classes.

#include <datetime.h>
Inheritance diagram for mysqlpp::DTbase< T >:

Public Member Functions


virtual DTbase ()

Destroy object.
operator std::string () const

Return a copy of the item in C++ string form.


virtual MYSQLPP_EXPORT short compare (const T &other)
const=0

Compare this object to another of the same type.


bool operator== (const T &other) const

Returns true if "other" is equal to this object.


bool operator!= (const T &other) const

Returns true if "other" is not equal to this object.


bool operator< (const T &other) const

Returns true if "other" is less than this object.


bool operator<= (const T &other) const

Returns true if "other" is less than or equal to this object.


bool operator> (const T &other) const

Returns true if "other" is greater than this object.


bool operator>= (const T &other) const

Returns true if "other" is greater than or equal to this object.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

86

MySQL++ Class Documentation

7.17.1 Detailed Description


template<class T> struct mysqlpp::DTbase< T >
Base class template for MySQL++ date and time classes.
This template primarily denes the comparison operators, which are all implemented in terms of compare()(p. 86). Each subclass implements that as a
protected method, because these operators are the only supported comparison
method.
This template also denes interfaces for converting the object to a string form,
which a subclass must dene.

7.17.2 Member Function Documentation


[Link]

template<class T> virtual MYSQLPP_EXPORT short


mysqlpp::DTbase< T >::compare (const T & other) const
[pure virtual]

Compare this object to another of the same type.


Returns < 0 if this object is "before" the other, 0 of they are equal, and > 0 if
this object is "after" the other.
Implemented in mysqlpp::DateTime (p. 83), mysqlpp::Date (p. 80), and
mysqlpp::Time (p. 174).
The documentation for this struct was generated from the following le:
datetime.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.18 mysqlpp::EndOfResults Class Reference

87

7.18 mysqlpp::EndOfResults Class Reference


Exception(p. 93) thrown when ResUse::fetch_row()(p. 146) walks o the
end of a use-query's result set.

#include <exceptions.h>
Inheritance diagram for mysqlpp::EndOfResults:Collaboration diagram for
mysqlpp::EndOfResults:

Public Member Functions


EndOfResults (const char w="end of results")

Create exception object.

7.18.1 Detailed Description


Exception(p. 93) thrown when ResUse::fetch_row()(p. 146) walks o the
end of a use-query's result set.

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

88

MySQL++ Class Documentation

7.19 mysqlpp::EndOfResultSets Class Reference


Exception(p. 93) thrown when Query::store_next()(p. 133) walks o the
end of a use-query's multi result sets.

#include <exceptions.h>
Inheritance diagram for mysqlpp::EndOfResultSets:Collaboration diagram for
mysqlpp::EndOfResultSets:

Public Member Functions


EndOfResultSets (const char w="end of result sets")

Create exception object.

7.19.1 Detailed Description


Exception(p. 93) thrown when Query::store_next()(p. 133) walks o the
end of a use-query's multi result sets.

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.20 mysqlpp::equal_list_b< Seq1, Seq2, Manip > Struct Template


Reference
89

7.20 mysqlpp::equal_list_b< Seq1, Seq2, Manip


> Struct Template Reference
Same as equal_list_ba(p. 91), plus the option to have some elements of the
equals clause suppressed.

#include <vallist.h>
Collaboration diagram for mysqlpp::equal_list_b< Seq1, Seq2, Manip >:

Public Member Functions


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

Create object.

Public Attributes
const Seq1 list1

the list of objects on the left-hand side of the equals sign


const Seq2 list2

the list of objects on the right-hand side of the equals sign


const std::vector< bool > elds

for each true item in the list, the pair in that position will be inserted into a
C++ stream
const char delem

delimiter to use between each pair of elements


const char equl

"equal" sign to use between each item in each equal pair; doesn't have to
actually be " = "
Manip manip

manipulator to use when inserting the equal_list into a C++ stream

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

90

MySQL++ Class Documentation

7.20.1 Detailed Description


template<class Seq1,
class Seq2,
class
mysqlpp::equal_list_b< Seq1, Seq2, Manip >

Manip>

struct

Same as equal_list_ba(p. 91), plus the option to have some elements of the
equals clause suppressed.
Imagine an object of this type contains the lists (a, b, c) (d, e, f), that the
object's 'elds' list is (true, false, true), and that the object's delimiter and
equals symbols are set to " AND " and " = " respectively. When you insert
that object into a C++ stream, you would get "a = d AND c = f".
See equal_list_ba's documentation for more details.

7.20.2 Constructor & Destructor Documentation


[Link]

template<class Seq1, class Seq2, class Manip>


mysqlpp::equal_list_b< Seq1, Seq2, Manip
>::equal_list_b (const Seq1 & s1, const Seq2 & s2, const
std::vector< bool > & f, const char d, const char e,
Manip m) [inline]

Create object.

Parameters:

s1 list of objects on left-hand side of equal sign


s2 list of objects on right-hand side of equal sign
f for each true item in the list, the pair of items in that position will be
d
e
m

inserted into a C++ stream

what delimiter to use between each group in the list when inserting the
list into a C++ stream
the "equals" sign between each pair of items in the equal list; doesn't
actually have to be " = "!
manipulator to use when inserting the list into a C++ stream

The documentation for this struct was generated from the following le:
vallist.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.21 mysqlpp::equal_list_ba< Seq1, Seq2, Manip > Struct


Template Reference

91

7.21 mysqlpp::equal_list_ba< Seq1, Seq2, Manip > Struct Template Reference


Holds two lists of items, typically used to construct a SQL "equals clause".

#include <vallist.h>
Collaboration diagram for mysqlpp::equal_list_ba< Seq1, Seq2, Manip >:

Public Member Functions


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

Create object.

Public Attributes
const Seq1 list1

the list of objects on the left-hand side of the equals sign


const Seq2 list2

the list of objects on the right-hand side of the equals sign


const char delem

delimiter to use between each pair of elements


const char equl

"equal" sign to use between each item in each equal pair; doesn't have to
actually be " = "
Manip manip

manipulator to use when inserting the equal_list into a C++ stream

7.21.1 Detailed Description


template<class Seq1,
class Seq2,
class
mysqlpp::equal_list_ba< Seq1, Seq2, Manip >

Manip>

struct

Holds two lists of items, typically used to construct a SQL "equals clause".

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

92

MySQL++ Class Documentation

The WHERE clause in a SQL SELECT statment is an example of an equals


clause.
Imagine an object of this type contains the lists (a, b) (c, d), and that the
object's delimiter and equals symbols are set to ", " and " = " respectively.
When you insert that object into a C++ stream, you would get "a = c, b = d".
This class is never instantiated by hand. The equal_list()(p. 29) functions
build instances of this structure template to do their work. MySQL++'s SSQLS
mechanism calls those functions when building SQL queries; you can call them
yourself to do similar work. The "Harnessing SSQLS Internals" section of the
user manual has some examples of this.

See also:
equal_list_b(p. 89)

7.21.2 Constructor & Destructor Documentation


[Link]

template<class Seq1, class Seq2, class Manip>


mysqlpp::equal_list_ba< Seq1, Seq2, Manip
>::equal_list_ba (const Seq1 & s1, const Seq2 & s2, const
char d, const char e, Manip m) [inline]

Create object.

Parameters:

s1 list of objects on left-hand side of equal sign


s2 list of objects on right-hand side of equal sign
d what delimiter to use between each group in the list when inserting the
e
m

list into a C++ stream

the "equals" sign between each pair of items in the equal list; doesn't
actually have to be " = "!
manipulator to use when inserting the list into a C++ stream

The documentation for this struct was generated from the following le:
vallist.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.22 mysqlpp::Exception Class Reference

7.22 mysqlpp::Exception Class Reference


Base class for all MySQL++ custom exceptions.

#include <exceptions.h>
Inheritance diagram for mysqlpp::Exception:

Public Member Functions


Exception (const Exception &e) throw ()

Create exception object as copy of another.


Exception & operator= (const Exception &rhs) throw ()

Assign another exception object's contents to this one.


Exception () throw ()

Destroy exception object.


virtual const char what () const throw ()

Returns explanation of why exception was thrown.

Protected Member Functions


Exception (const char w="") throw ()

Create exception object.


Exception (const std::string &w) throw ()

Create exception object.

Protected Attributes
std::string what_

explanation of why exception was thrown

7.22.1 Detailed Description


Base class for all MySQL++ custom exceptions.
The documentation for this class was generated from the following le:

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

93

94

MySQL++ Class Documentation


exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.23 mysqlpp::FieldNames Class Reference

95

7.23 mysqlpp::FieldNames Class Reference


Holds a list of SQL eld names.

#include <field_names.h>

Public Member Functions


FieldNames ()

Default constructor.
FieldNames (const ResUse res)

Create eld name list from a result set.


FieldNames (int i)

Create empty eld name list, reserving space for a xed number of eld
names.
FieldNames & operator= (const ResUse res)

Initializes the eld list from a result set.


FieldNames & operator= (int i)

Insert i empty eld names at beginning of list.


std::string & operator[ ] (int i)

Get the name of a eld given its index.


const std::string & operator[ ] (int i) const

Get the name of a eld given its index, in const context.


uint operator[ ] (std::string i) const

Get the index number of a eld given its name.

7.23.1 Detailed Description


Holds a list of SQL eld names.
The documentation for this class was generated from the following les:
eld_names.h
eld_names.cpp

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

96

MySQL++ Class Documentation

7.24 mysqlpp::Fields Class Reference


A container similar to std::vector for holding mysqlpp::Field(p. 17) records.

#include <fields.h>
Inheritance diagram
mysqlpp::Fields:

for

mysqlpp::Fields:Collaboration

diagram

for

Public Member Functions


Fields ()

Default constructor.
Fields (ResUse r)

Create a eld list from a result set.


const Field & at (Fields::size_type i) const

Returns a eld given its index.


const Field & at (int i) const

Returns a eld given its index.


size_type size () const

get the number of elds

7.24.1 Detailed Description


A container similar to std::vector for holding mysqlpp::Field(p. 17) records.
The documentation for this class was generated from the following les:
elds.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.25 mysqlpp::FieldTypes Class Reference

97

7.25 mysqlpp::FieldTypes Class Reference


A vector of SQL eld types.

#include <field_types.h>

Public Member Functions


FieldTypes ()

Default constructor.
FieldTypes (const ResUse res)

Create list of eld types from a result set.


FieldTypes (int i)

Create xed-size list of uninitialized eld types.


FieldTypes & operator= (const ResUse res)

Initialize eld list based on a result set.


FieldTypes & operator= (int i)

Insert a given number of uninitialized eld type objects at the beginning of


the list.
mysql_type_info & operator[ ] (int i)

Returns a eld type within the list given its index.


const mysql_type_info & operator[ ] (int i) const

Returns a eld type within the list given its index, in const context.

7.25.1 Detailed Description


A vector of SQL eld types.

7.25.2 Member Function Documentation


[Link]

FieldTypes& mysqlpp::FieldTypes::operator= (int i)


[inline]

Insert a given number of uninitialized eld type objects at the beginning of the
list.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

98

MySQL++ Class Documentation

Parameters:

number of eld type objects to insert

The documentation for this class was generated from the following les:
eld_types.h
eld_types.cpp

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.26 mysqlpp::Lock Class Reference

7.26 mysqlpp::Lock Class Reference


Abstract base class for lock implementation, used by Lockable(p. 100).

#include <lockable.h>
Inheritance diagram for mysqlpp::Lock:

Public Member Functions


virtual Lock ()

Destroy object.

virtual bool lock ()=0

Lock(p. 99) the object.

virtual void unlock ()=0

Unlock the object.

virtual bool locked () const=0

Returns true if object is locked.

virtual void set (bool b)=0

Set(p. 161) the lock state.

7.26.1 Detailed Description


Abstract base class for lock implementation, used by Lockable(p. 100).

7.26.2 Member Function Documentation


[Link]

virtual bool mysqlpp::Lock::lock () [pure virtual]

Lock(p. 99) the object.


Returns:

true if object was already locked

Implemented in mysqlpp::BasicLock (p. 50).


The documentation for this class was generated from the following le:
lockable.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

99

100

MySQL++ Class Documentation

7.27 mysqlpp::Lockable Class Reference


Interface allowing a class to declare itself as "lockable".

#include <lockable.h>
Inheritance diagram
mysqlpp::Lockable:

for

mysqlpp::Lockable:Collaboration

diagram

for

Protected Member Functions


Lockable (bool is_locked)

Default constructor.

virtual Lockable ()

Destroy object.

virtual bool lock ()

Lock(p. 99) the object.

virtual void unlock ()

Unlock the object.

bool locked () const

Returns true if object is locked.

void set_lock (bool b)

Set(p. 161) the lock state. Protected, because this method is only for use by
subclass assignment operators and the like.

7.27.1 Detailed Description


Interface allowing a class to declare itself as "lockable".
A class derives from this one to acquire a standard interface for serializing
operations that may not be thread-safe.

7.27.2 Member Function Documentation


[Link]

virtual bool mysqlpp::Lockable::lock () [inline,


protected, virtual]

Lock(p. 99) the object.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.27 mysqlpp::Lockable Class Reference


Returns:

true if object was already locked

The documentation for this class was generated from the following le:
lockable.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

101

102

MySQL++ Class Documentation

7.28 mysqlpp::LockFailed Class Reference


Exception(p. 93) thrown when a Lockable(p. 100) object fails.
#include <exceptions.h>
Inheritance diagram for mysqlpp::LockFailed:Collaboration diagram for
mysqlpp::LockFailed:

Public Member Functions


LockFailed (const char w="lock failed")

Create exception object.

7.28.1 Detailed Description


Exception(p. 93) thrown when a Lockable(p. 100) object fails.
Currently, "failure" means that the object is already locked when you make a
call that tries to lock it again. In the future, that case will probably result in
the second thread blocking, but the thread library could assert other errors that
would keep this exception relevant.
The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.29 mysqlpp::mysql_type_info Class Reference

103

7.29 mysqlpp::mysql_type_info Class Reference


Holds basic type information for ColData.

#include <type_info.h>

Public Member Functions


mysql_type_info (unsigned char n=static_cast< unsigned char >(1))

Create object.
mysql_type_info (enum_eld_types t, bool _unsigned, bool _null)

Create object from MySQL C API type info.


mysql_type_info (const MYSQL_FIELD &f)

Create object from a MySQL C API eld.


mysql_type_info (const mysql_type_info &t)

Create object as a copy of another.


mysql_type_info (const std::type_info &t)

Create object from a C++ type_info object.


mysql_type_info & operator= (unsigned char n)

Assign a new internal type value.


mysql_type_info & operator= (const mysql_type_info &t)

Assign another mysql_type_info(p. 103) object to this object.

mysql_type_info & operator= (const std::type_info &t)

Assign a C++ type_info object to this object.


const char name () const

Returns an implementation-dened name of the C++ type.


const char sql_name () const

Returns the name of the SQL type.


const std::type_info & c_type () const

Returns the type_info for the C++ type associated with the SQL type.
const unsigned int length () const

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

104

MySQL++ Class Documentation


Return length of data in this eld.

const unsigned int max_length () const

Return maximum length of data in this eld.


const mysql_type_info base_type () const

Returns the type_info for the C++ type inside of the mysqlpp::Null(p. 110)
type.

int id () const

Returns the ID of the SQL type.


bool quote_q () const

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


bool escape_q () const

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


bool before (mysql_type_info &b)

Provides a way to compare two types for sorting.

Public Attributes
unsigned int _length

eld length, from MYSQL_FIELD


unsigned int _max_length

max data length, from MYSQL_FIELD

Static Public Attributes


const unsigned char string_type = 20

The internal constant we use for our string type.

7.29.1 Detailed Description


Holds basic type information for ColData.
Class to hold basic type information for mysqlpp::ColData(p. 17).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.29 mysqlpp::mysql_type_info Class Reference

105

7.29.2 Constructor & Destructor Documentation


[Link]

mysqlpp::mysql_type_info::mysql_type_info (unsigned
char n = static_cast<unsigned char>(-1)) [inline]

Create object.

Parameters:

index into the internal type table

Because of the n parameter's denition, this constructor shouldn't be used outside the library.
The default is intended to try and crash a program using a default mysql_type_info(p. 103) object. This is a very wrong thing to do.

[Link]

mysqlpp::mysql_type_info::mysql_type_info
(enum_eld_types t, bool _unsigned, bool _null)
[inline]

Create object from MySQL C API type info.

Parameters:

t the MySQL C API type ID for this type


_unsigned if true, this is the unsigned version of the type
_null if true, this type can hold a SQL null

[Link]

mysqlpp::mysql_type_info::mysql_type_info (const
MYSQL_FIELD & f) [inline]

Create object from a MySQL C API eld.

Parameters:

eld from which we extract the type info

[Link]

mysqlpp::mysql_type_info::mysql_type_info (const
std::type_info & t) [inline]

Create object from a C++ type_info object.


This tries to map a C++ type to the closest MySQL data type. It is necessarily
somewhat approximate.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

106

MySQL++ Class Documentation

7.29.3 Member Function Documentation


[Link]

const mysql_type_info mysqlpp::mysql_type_info::base_type () const [inline]

Returns the type_info for the C++ type inside of the mysqlpp::Null(p. 110)
type.
Returns the type_info for the C++ type inside the mysqlpp::Null(p. 110)
type. If the type is not Null(p. 110) then this is the same as c_type()(p. 106).

[Link]

bool mysqlpp::mysql_type_info::before (mysql_type_info


& b) [inline]

Provides a way to compare two types for sorting.


Returns true if the SQL ID of this type is lower than that of another. Used by
mysqlpp::type_info_cmp when comparing types.

[Link]

const std::type_info& mysqlpp::mysql_type_info::c_type


() const [inline]

Returns the type_info for the C++ type associated with the SQL type.
Returns the C++ type_info record corresponding to the SQL type.

[Link]

bool mysqlpp::mysql_type_info::escape_q () const

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

Returns:

true if the type needs to be escaped for syntactically correct SQL.

[Link]

int mysqlpp::mysql_type_info::id () const [inline]

Returns the ID of the SQL type.


Returns the ID number MySQL uses for this type. Note: Do not depend on the
value of this ID as it may change between MySQL versions.

[Link]

const unsigned int mysqlpp::mysql_type_info::length ()


const [inline]

Return length of data in this eld.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.29 mysqlpp::mysql_type_info Class Reference

107

This only works if you initialized this object from a MYSQL_FIELD object.

[Link]

const unsigned int mysqlpp::mysql_type_info::max_length () const [inline]

Return maximum length of data in this eld.


This only works if you initialized this object from a MYSQL_FIELD object.

[Link]

const char mysqlpp::mysql_type_info::name () const


[inline]

Returns an implementation-dened name of the C++ type.


Returns the name that would be returned by typeid().name()(p. 107) for the
C++ type associated with the SQL type.

[Link]

mysql_type_info& mysqlpp::mysql_type_info::operator=
(const std::type_info & t) [inline]

Assign a C++ type_info object to this object.


This tries to map a C++ type to the closest MySQL data type. It is necessarily
somewhat approximate.

[Link]

mysql_type_info& mysqlpp::mysql_type_info::operator= (unsigned char n)


[inline]

Assign a new internal type value.

Parameters:

an index into the internal MySQL++ type table

This function shouldn't be used outside the library.

[Link]

bool mysqlpp::mysql_type_info::quote_q () const

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

Returns:

true if the type needs to be quoted for syntactically correct SQL.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

108
[Link]

MySQL++ Class Documentation


const char mysqlpp::mysql_type_info::sql_name ()
const [inline]

Returns the name of the SQL type.


Returns the SQL name for the type.

7.29.4 Member Data Documentation


[Link]

const unsigned char mysqlpp::mysql_type_info::string_type = 20 [static]

The internal constant we use for our string type.


We expose this because other parts of MySQL++ need to know what the string
constant is at the moment.
The documentation for this class was generated from the following les:
type_info.h
type_info.cpp

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.30 mysqlpp::NoExceptions Class Reference

109

7.30 mysqlpp::NoExceptions Class Reference


Disable exceptions in an object derived from OptionalExceptions(p. 119).

#include <noexceptions.h>
Collaboration diagram for mysqlpp::NoExceptions:

Public Member Functions


NoExceptions (OptionalExceptions &a)

Constructor.

NoExceptions ()

Destructor.

7.30.1 Detailed Description


Disable exceptions in an object derived from OptionalExceptions(p. 119).
This class was designed to be created on the stack, taking a reference to a
subclass of OptionalExceptions(p. 119). (We call that our "associate" object.) On creation, we save that object's current exception state, and disable
exceptions. On destruction, we restore our associate's previous state.

7.30.2 Constructor & Destructor Documentation


[Link]

mysqlpp::NoExceptions::NoExceptions
(OptionalExceptions & a) [inline]

Constructor.
Takes a reference to an OptionalExceptions(p. 119) derivative, saves that
object's current exception state, and disables exceptions.

[Link]

mysqlpp::NoExceptions::NoExceptions () [inline]

Destructor.
Restores our associate object's previous exception state.
The documentation for this class was generated from the following le:
noexceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

110

MySQL++ Class Documentation

7.31 mysqlpp::Null< Type, Behavior


Template Reference

>

Class

Class for holding data from a SQL column with the NULL attribute.

#include <null.h>
Collaboration diagram for mysqlpp::Null< Type, Behavior >:

Public Types
typedef Type value_type

Type of the data stored in this object, when it is not equal to SQL null.

Public Member Functions


Null ()

Default constructor.
Null (const Type &x)

Initialize the object with a particular value.


Null (const null_type &n)

Construct a Null(p. 110) equal to SQL null.

operator Type & ()

Converts this object to Type.


Null & operator= (const Type &x)

Assign a value to the object.


Null & operator= (const null_type &n)

Assign SQL null to this object.

Public Attributes
Type data

The object's value, when it is not SQL null.


bool is_null

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.31 mysqlpp::Null< Type, Behavior > Class Template Reference111


If set, this object is considered equal to SQL null.

7.31.1 Detailed Description


template<class Type, class Behavior
mysqlpp::Null< Type, Behavior >

NullisNull>

class

Class for holding data from a SQL column with the NULL attribute.
This template is necessary because there is nothing in the C++ type system
with the same semantics as SQL's null. In SQL, a column can have the optional
'NULL' attribute, so there is a dierence in type between, say an int column
that can be null and one that cannot be. C++'s NULL constant does not have
these features.
It's important to realize that this class doesn't hold nulls, it holds data that
can be null. It can hold a non-null value, you can then assign null to it (using
MySQL++'s global null object), and then assign a regular value to it again;
the object will behave as you expect throughout this process.
Because one of the template parameters is a C++ type, the typeid() for a null
int is dierent than for a null string, to pick two random examples. See
type_info.cpp(p. ??) for the table SQL types that can be null.

7.31.2 Constructor & Destructor Documentation


[Link]

template<class Type, class Behavior = NullisNull>


mysqlpp::Null< Type, Behavior >::Null () [inline]

Default constructor.
"data" member is left uninitialized by this ctor, because we don't know what
to initialize it to.

[Link]

template<class Type, class Behavior = NullisNull>


mysqlpp::Null< Type, Behavior >::Null (const Type & x)
[inline]

Initialize the object with a particular value.


The object is marked as "not null" if you use this ctor. This behavior exists
because the class doesn't encode nulls, but rather data which can be null. The
distinction is necessary because 'NULL' is an optional attribute of SQL columns.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

112
[Link]

MySQL++ Class Documentation


template<class Type, class Behavior = NullisNull>
mysqlpp::Null< Type, Behavior >::Null (const null_type
& n) [inline]

Construct a Null(p. 110) equal to SQL null.


This is typically used with the global null object. (Not to be confused with C's
NULL type.) You can say something like...
Null<int> foo = null;

...to get a null int.

7.31.3 Member Function Documentation


[Link]

template<class Type, class Behavior = NullisNull>


mysqlpp::Null< Type, Behavior >::operator Type & ()
[inline]

Converts this object to Type.


If is_null is set, returns whatever we consider that null "is", according to the
Behavior parameter you used when instantiating this template. See NullisNull(p. 116), NullisZero(p. 117) and NullisBlank(p. 115).
Otherwise, just returns the 'data' member.

[Link]

template<class Type, class Behavior = NullisNull> Null&


mysqlpp::Null< Type, Behavior >::operator= (const
null_type & n) [inline]

Assign SQL null to this object.


This just sets the is_null ag; the data member is not aected until you call
the Type() operator on it.

[Link]

template<class Type, class Behavior = NullisNull> Null&


mysqlpp::Null< Type, Behavior >::operator= (const Type
& x) [inline]

Assign a value to the object.


This marks the object as "not null" as a side eect.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.31 mysqlpp::Null< Type, Behavior > Class Template Reference113

7.31.4 Member Data Documentation


[Link]

template<class Type, class Behavior = NullisNull> bool


mysqlpp::Null< Type, Behavior >::is_null

If set, this object is considered equal to SQL null.


This ag aects how the Type() and << operators work.
The documentation for this class was generated from the following le:
null.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

114

MySQL++ Class Documentation

7.32 mysqlpp::null_type Class Reference


The type of the global mysqlpp::null(p. 25) object.

#include <null.h>

7.32.1 Detailed Description


The type of the global mysqlpp::null(p. 25) object.
This class is for internal use only. Normal code should use Null(p. 110) instead.
The documentation for this class was generated from the following le:
null.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.33 mysqlpp::NullisBlank Struct Reference

115

7.33 mysqlpp::NullisBlank Struct Reference


Class for objects that dene SQL null as a blank C string.

#include <null.h>

7.33.1 Detailed Description


Class for objects that dene SQL null as a blank C string.
Returns "" when you ask what null is, and is empty when you insert it into a
C++ stream.
Used for the behavior parameter for template Null(p. 110)
The documentation for this struct was generated from the following le:
null.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

116

MySQL++ Class Documentation

7.34 mysqlpp::NullisNull Struct Reference


Class for objects that dene SQL null in terms of MySQL++'s null_type(p. 114).

#include <null.h>

7.34.1 Detailed Description


Class for objects that dene SQL null in terms of MySQL++'s null_-

type(p. 114).

Returns a null_type(p. 114) instance when you ask what null is, and is
"(NULL)" when you insert it into a C++ stream.
Used for the behavior parameter for template Null(p. 110)
The documentation for this struct was generated from the following le:
null.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.35 mysqlpp::NullisZero Struct Reference

117

7.35 mysqlpp::NullisZero Struct Reference


Class for objects that dene SQL null as 0.

#include <null.h>

7.35.1 Detailed Description


Class for objects that dene SQL null as 0.
Returns 0 when you ask what null is, and is zero when you insert it into a C++
stream.
Used for the behavior parameter for template Null(p. 110)
The documentation for this struct was generated from the following le:
null.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

118

MySQL++ Class Documentation

7.36 mysqlpp::ObjectNotInitialized Class Reference


Exception(p. 93) thrown when you try to use an object that isn't completely
initialized.

#include <exceptions.h>
Inheritance diagram for mysqlpp::ObjectNotInitialized:Collaboration diagram
for mysqlpp::ObjectNotInitialized:

Public Member Functions


ObjectNotInitialized (const char w="")

Create exception object.

7.36.1 Detailed Description


Exception(p. 93) thrown when you try to use an object that isn't completely
initialized.

The documentation for this class was generated from the following le:
exceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.37 mysqlpp::OptionalExceptions Class Reference

119

7.37 mysqlpp::OptionalExceptions Class Reference


Interface allowing a class to have optional exceptions.

#include <noexceptions.h>
Inheritance diagram for mysqlpp::OptionalExceptions:

Public Member Functions


OptionalExceptions (bool e=true)

Default constructor.
virtual OptionalExceptions ()

Destroy object.
void enable_exceptions ()

Enable exceptions from the object.


void disable_exceptions ()

Disable exceptions from the object.


bool throw_exceptions () const

Returns true if exceptions are enabled.

Protected Member Functions


void set_exceptions (bool e)

Sets the exception state to a particular value.

Friends
class NoExceptions

Declare NoExceptions(p. 109) to be our friend so it can access our protected


functions.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

120

MySQL++ Class Documentation

7.37.1 Detailed Description


Interface allowing a class to have optional exceptions.
A class derives from this one to acquire a standard interface for disabling exceptions, possibly only temporarily. By default, exceptions are enabled.

7.37.2 Constructor & Destructor Documentation


[Link]

mysqlpp::OptionalExceptions::OptionalExceptions (bool e
= true) [inline]

Default constructor.

Parameters:

if true, exceptions are enabled (this is the default)

7.37.3 Member Function Documentation


[Link]

void mysqlpp::OptionalExceptions::set_exceptions (bool


e) [inline, protected]

Sets the exception state to a particular value.


This method is protected because it is only intended for use by subclasses' copy
constructors and the like.
The documentation for this class was generated from the following le:
noexceptions.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

121

7.38 mysqlpp::Query Class Reference


A class for building and executing SQL queries.

#include <query.h>
Inheritance diagram
mysqlpp::Query:

for

mysqlpp::Query:Collaboration

diagram

for

Public Member Functions


Query (Connection c, bool te=true)

Create a new query object attached to a connection.


Query (const Query &q)

Create a new query object as a copy of another.


Query & operator= (const Query &rhs)

Assign another query's state to this object.


std::string error ()

Get the last error message that was set.


bool success ()

Returns true if the last operation succeeded.


void parse ()

Treat the contents of the query string as a template query.


void reset ()

Reset the query object so that it can be reused.


std::string preview ()

Return the query string currently in the buer.


std::string preview (const SQLString &arg0)

Return the query string currently in the buer with template query parameter
substitution.
std::string preview (SQLQueryParms &p)

Return the query string currently in the buer.


std::string str ()

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

122

MySQL++ Class Documentation


Get built query as a null-terminated C++ string.

std::string str (const SQLString &arg0)

Get built query as a null-terminated C++ string with template query parameter substitution.
std::string str (query_reset r)

Get built query as a null-terminated C++ string.


std::string str (SQLQueryParms &p)

Get built query as a null-terminated C++ string.


std::string str (SQLQueryParms &p, query_reset r)

Get built query as a null-terminated C++ string.


bool exec (const std::string &str)

Execute a query.
ResNSel execute ()

Execute built-up query.


ResNSel execute (const SQLString &str)

Execute query in a C++ string, or substitute string into a template query


and execute it.
ResNSel execute (const char str)

Execute query in a C string.


ResNSel execute (const char str, size_t len)

Execute query in a known-length string of characters. This can include null


characters.
ResUse use ()

Execute a query that can return a result set.


ResUse use (const SQLString &str)

Execute query in a C++ string.


ResUse use (const char str)

Execute query in a C string.


ResUse use (const char str, size_t len)

Execute query in a known-length C string.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

123

Result store ()

Execute a query that can return a result set.


Result store (const SQLString &str)

Execute query in a C++ string.


Result store (const char str)

Execute query in a C string.


Result store (const char str, size_t len)

Execute query in a known-length C string.


template<typename Function> Function for_each (const SQLString
&query, Function fn)

Execute a query, and call a functor for each returned row.


template<typename Function> Function for_each (Function fn)

Execute the query, and call a functor for each returned row.
template<class SSQLS, typename Function> Function for_each (const
SSQLS &ssqls, Function fn)

Run a functor for every row in a table.


template<class Sequence, typename Function> Function store_if (Sequence &seq, const SQLString &query, Function fn)

Execute a query, conditionally storing each row in a container.


template<class Sequence, class SSQLS, typename Function> Function
store_if (Sequence &seq, const SSQLS &ssqls, Function fn)

Pulls every row in a table, conditionally storing each one in a container.


template<class Sequence, typename Function> Function store_if (Sequence &seq, Function fn)

Execute the query, conditionally storing each row in a container.


Result store_next ()

Return next result set, when processing a multi-query.


bool more_results ()

Return whether more results are waiting for a multi-query or stored procedure
response.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

124

MySQL++ Class Documentation

template<class Sequence> void storein_sequence (Sequence &con,


query_reset r=RESET_QUERY)

Execute a query, storing the result set in an STL sequence container.


template<class Set> void storein_set (Set &con, query_reset
r=RESET_QUERY)

Execute a query, storing the result set in an STL associative container.


template<class Container> void storein (Container &con, query_reset
r=RESET_QUERY)

Execute a query, and store the entire result set in an STL container.
template<class T> void storein (std::vector< T > &con, const char s)

Specialization of storein_sequence()(p. 134) for std::vector.

template<class T> void storein (std::deque< T > &con, const char s)

Specialization of storein_sequence()(p. 134) for std::deque.

template<class T> void storein (std::list< T > &con, const char s)

Specialization of storein_sequence()(p. 134) for std::list.

template<class T> void storein (std::set< T > &con, const char s)

Specialization of storein_set()(p. 135) for std::set.

template<class T> void storein (std::multiset< T > &con, const char


s)

Specialization of storein_set()(p. 135) for std::multiset.


template<class T> Query & update (const T &o, const T &n)

Replace an existing row's data with new data.


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

Insert a new row.


template<class Iter> Query & insert (Iter rst, Iter last)

Insert multiple new rows.


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

Insert new row unless there is an existing row that matches on a unique
index, in which case we replace it.
operator bool ()

Return true if the last query was successful.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

125

bool operator! ()

Return true if the last query failed.

Public Attributes
SQLQueryParms def

The default template parameters.

Friends
class SQLQueryParms

7.38.1 Detailed Description


A class for building and executing SQL queries.
This class is derived from SQLQuery. It adds to that a tie between the query
object and a MySQL++ Connection (p. 58) object, so that the query can be
sent to the MySQL server we're connected to.
One does not generally create Query(p. 121) objects directly. Instead, call
mysqlpp::Connection::query()(p. 68) to get one tied to that connection.
There are several ways to build and execute SQL queries with this class.
The way most like other database libraries is to pass a SQL statement to one
of the exec(), (p. 127) store(), (p. 132) or use()(p. 137) methods taking a C
or C++ string. The query is executed immediately, and any results returned.
For more complicated queries, you can use Query's stream interface. You simply
build up a query using the Query(p. 121) instance as you would any other C++
stream object. When the query string is complete, you call the overloaded
version of exec(), store() or use()(p. 137) that takes no parameters, which
executes the built query and returns any results.
If you are using the library's Specialized SQL Structures feature, Query(p. 121)
has several special functions for generating common SQL queries from those
structures. For instance, it oers the insert() (p. 129) method, which builds
an INSERT query to add the contents of the SSQLS to the database. As with
the stream interface, these methods only build the query string; call one of the
parameterless methods mentioned previously to actually execute the query.
Finally, you can build "template queries". This is something like C's printf()
function, in that you insert a specially-formatted query string into the object

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

126

MySQL++ Class Documentation

which contains placeholders for data. You call the parse()(p. 130) method
to tell the Query(p. 121) object that the query string contains placeholders.
Once that's done, you can call any of the many overloaded methods that take a
number of SQLStrings (up to 25 by default) or any type that can be converted to
SQLString(p. 167), and those parameters will be inserted into the placeholders.
When you call one of the parameterless functions the execute the query, the nal
query string is assembled and sent to the server.
See the user manual for more details about these options.

7.38.2 Constructor & Destructor Documentation


[Link]

mysqlpp::Query::Query (Connection c, bool te = true)

Create a new query object attached to a connection.


This is the constructor used by mysqlpp::Connection::query()(p. 68).

Parameters:

c connection the nished query should be sent out on


te if true, throw exceptions on errors

[Link]

mysqlpp::Query::Query (const Query & q)

Create a new query object as a copy of another.


This is not a traditional copy ctor! Its only purpose is to make it possible to
assign the return of Connection::query()(p. 68) to an empty Query(p. 121)
object. In particular, the stream buer and template query stu will be empty
in the copy, regardless of what values they have in the original.

7.38.3 Member Function Documentation


[Link]

std::string mysqlpp::Query::error ()

Get the last error message that was set.


This class has an internal error message string, but if it isn't set, we return the
last error message that happened on the connection we're bound to instead.

[Link]

bool mysqlpp::Query::exec (const std::string & str)

Execute a query.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

127

Same as execute()(p. 127), except that it only returns a ag indicating whether
the query succeeded or not. It is basically a thin wrapper around the C API
function mysql_real_query().

Parameters:

str

the query to execute

Returns:

true if query was executed successfully

See also:
execute()(p. 127), store()(p. 132), storein()(p. 134), and use()(p. 137)
[Link]

ResNSel mysqlpp::Query::execute (const char str, size_t


len)

Execute query in a known-length string of characters. This can include null


characters.
Executes the query immediately, and returns the results.

[Link]

ResNSel mysqlpp::Query::execute (const char str)

Execute query in a C string.


Executes the query immediately, and returns the results.

[Link]

ResNSel mysqlpp::Query::execute (const SQLString & str)

Execute query in a C++ string, or substitute string into a template query and
execute it.

Parameters:

str

If the object represents a compiled template query, substitutes this


string in for the rst parameter. Otherwise, takes the string as a
complete SQL query and executes it.

[Link]

ResNSel mysqlpp::Query::execute () [inline]

Execute built-up query.


Use one of the execute()(p. 127) overloads if you don't expect the server to
return a result set. For instance, a DELETE query. The returned ResNSel(p. 139) object contains status information from the server, such as whether
the query succeeded, and if so how many rows were aected.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

128

MySQL++ Class Documentation

This overloaded version of execute()(p. 127) simply executes the query that you
have built up in the object in some way. (For instance, via the insert()(p. 129)
method, or by using the object's stream interface.)

Returns:
ResNSel(p. 139) status information about the query
See also:
exec()(p. 126), store()(p. 132), storein()(p. 134), and use()(p. 137)

[Link]

template<class SSQLS, typename Function> Function


mysqlpp::Query::for_each (const SSQLS & ssqls, Function
fn) [inline]

Run a functor for every row in a table.


Just like for_each(Function)(p. 128), except that it builds a "select from
TABLE" query using the SQL table name from the SSQLS instance you pass.

Parameters:

ssqls the SSQLS instance to get a table name from


fn the functor called for each row

Returns:

a copy of the passed functor

[Link]

template<typename Function> Function


mysqlpp::Query::for_each (Function fn) [inline]

Execute the query, and call a functor for each returned row.
Just like for_each(const SQLString&, Function)(p. 129), but it uses the
query string held by the Query(p. 121) object already

Parameters:

fn

the functor called for each row

Returns:

a copy of the passed functor

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference


[Link]

129

template<typename Function> Function


mysqlpp::Query::for_each (const SQLString & query,
Function fn) [inline]

Execute a query, and call a functor for each returned row.


This method wraps a use()(p. 137) query, calling the given functor for every
returned row. It is analogous to STL's for_each()(p. 129) algorithm, but instead of iterating over some range within a container, it iterates over a result
set produced by a query.

Parameters:

query the query string


fn the functor called for each row

Returns:

a copy of the passed functor

[Link]

template<class Iter> Query& mysqlpp::Query::insert


(Iter rst, Iter last) [inline]

Insert multiple new rows.


Builds an INSERT SQL query using items from a range within an STL container. Insert the entire contents of the container by using the begin() and
end() iterators of the container as parameters to this function.

Parameters:

rst iterator pointing to rst element in range to insert


last iterator pointing to one past the last element to insert

See also:
replace()(p. 131), update()(p. 136)
[Link]

template<class T> Query& mysqlpp::Query::insert


(const T & v) [inline]

Insert a new row.


This function builds an INSERT SQL query. One uses it with MySQL++'s
Specialized SQL Structures mechanism.

Parameters:

new row

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

130

MySQL++ Class Documentation

See also:
replace()(p. 131), update()(p. 136)

[Link]

bool mysqlpp::Query::more_results ()

Return whether more results are waiting for a multi-query or stored procedure
response.
If this function returns true, you must call store_next()(p. 133) to fetch the
next result set before you can execute more queries.
Wraps mysql_more_results() in the MySQL C API. That function only exists
in MySQL v4.1 and higher. Therefore, this function always returns false when
built against older API libraries.

Returns:

true if another result set exists

[Link]

Query & mysqlpp::Query::operator= (const Query & rhs)

Assign another query's state to this object.


The same caveats apply to this operator as apply to the copy ctor.

[Link]

void mysqlpp::Query::parse ()

Treat the contents of the query string as a template query.


This method sets up the internal structures used by all of the other members
that accept template query parameters. See the "Template Queries" chapter in
the user manual for more information.

[Link]

std::string mysqlpp::Query::preview (const SQLString &


arg0) [inline]

Return the query string currently in the buer with template query parameter
substitution.

Parameters:

arg0

the value to substitute for the rst template query parameter

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference


[Link]

131

template<class T> Query& mysqlpp::Query::replace


(const T & v) [inline]

Insert new row unless there is an existing row that matches on a unique index,
in which case we replace it.
This function builds a REPLACE SQL query. One uses it with MySQL++'s
Specialized SQL Structures mechanism.

Parameters:

new row

See also:
insert()(p. 129), update()(p. 136)
[Link]

void mysqlpp::Query::reset ()

Reset the query object so that it can be reused.


This erases the query string and the contents of the parameterized query element
list.

[Link]

Result mysqlpp::Query::store (const char str, size_t


len)

Execute query in a known-length C string.


Executes the query immediately, and returns an object that contains the entire
result set. This is less memory-ecient than use()(p. 137), but it lets you have
random access to the results.

[Link]

Result mysqlpp::Query::store (const char str)

Execute query in a C string.


Executes the query immediately, and returns an object that contains the entire
result set. This is less memory-ecient than use()(p. 137), but it lets you have
random access to the results.

[Link]

Result mysqlpp::Query::store (const SQLString & str)

Execute query in a C++ string.


Executes the query immediately, and returns an object that contains the entire
result set. This is less memory-ecient than use()(p. 137), but it lets you have
random access to the results.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

132

MySQL++ Class Documentation

[Link]

Result mysqlpp::Query::store () [inline]

Execute a query that can return a result set.


Use one of the store()(p. 132) overloads to execute a query and retrieve the
entire result set into memory. This is useful if you actually need all of the
records at once, but if not, consider using one of the use()(p. 137) methods
instead, which returns the results one at a time, so they don't allocate as much
memory as store()(p. 132).
You must use store()(p. 132), storein()(p. 134) or use()(p. 137) for SELECT,
SHOW, DESCRIBE and EXPLAIN queries. You can use these functions with other
query types, but since they don't return a result set, exec()(p. 126) and execute()(p. 127) are more ecient.
The name of this method comes from the MySQL C API function it is implemented in terms of, mysql_store_result().
This function has the same set of overloads as execute()(p. 127).

Returns:
Result(p. 140) object containing entire result set
See also:
exec()(p. 126), execute()(p. 127), storein()(p. 134), and use()(p. 137)
[Link]

template<class Sequence, typename Function> Function


mysqlpp::Query::store_if (Sequence & seq, Function fn)
[inline]

Execute the query, conditionally storing each row in a container.


Just like store_if(Sequence&, const SQLString&, Function)(p. 133), but
it uses the query string held by the Query(p. 121) object already

Parameters:

seq the destination container; needs a push_back() method


fn the functor called for each row

Returns:

a copy of the passed functor

[Link]

template<class Sequence, class SSQLS, typename


Function> Function mysqlpp::Query::store_if (Sequence
& seq, const SSQLS & ssqls, Function fn) [inline]

Pulls every row in a table, conditionally storing each one in a container.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

133

Just like store_if(Sequence&, const SQLString&, Function)(p. 133), but


it uses the SSQLS instance to construct a "select from TABLE" query, using
the table name eld in the SSQLS.

Parameters:

seq the destination container; needs a push_back() method


ssqls the SSQLS instance to get a table name from
fn the functor called for each row

Returns:

a copy of the passed functor

[Link]

template<class Sequence, typename Function> Function


mysqlpp::Query::store_if (Sequence & seq, const
SQLString & query, Function fn) [inline]

Execute a query, conditionally storing each row in a container.


This method wraps a use()(p. 137) query, calling the given functor for every
returned row, and storing the results in the given sequence container if the
functor returns true.
This is analogous to the STL copy_if() algorithm, except that the source rows
come from a database query instead of another container. (copy_if() isn't a
standard STL algorithm, but only due to an oversight by the standardization
committee.) This fact may help you to remember the order of the parameters:
the container is the destination, the query is the source, and the functor is the
predicate; it's just like an STL algorithm.

Parameters:

seq the destination container; needs a push_back() method


query the query string
fn the functor called for each row

Returns:

a copy of the passed functor

[Link]

Result mysqlpp::Query::store_next ()

Return next result set, when processing a multi-query.


There are two cases where you'd use this function instead of the regular
store()(p. 132) functions.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

134

MySQL++ Class Documentation

First, when handling the result of executing multiple queries at once. (See this
page in the MySQL documentation for details.)
Second, when calling a stored procedure, MySQL can return the result as a set
of results.
In either case, you must consume all results before making another MySQL
query, even if you don't care about the remaining results or result sets.
As the MySQL documentation points out, you must set the MYSQL_OPTION_MULTI_STATEMENTS_ON ag on the connection in order to use
this feature. See Connection::set_option()(p. 69).
Multi-queries only exist in MySQL v4.1 and higher. Therefore, this function
just wraps store()(p. 132) when built against older API libraries.

Returns:
Result(p. 140) object containing the next result set.

[Link]

template<class Container> void mysqlpp::Query::storein


(Container & con, query_reset r = RESET_QUERY)
[inline]

Execute a query, and store the entire result set in an STL container.
This is a set of specialized template functions that call either storein_sequence()(p. 134) or storein_set()(p. 135), depending on the type of container you pass it. It understands std::vector, deque, list, slist (a common
C++ library extension), set, and multiset.
Like the functions it wraps, this is actually an overloaded set of functions. See
the other functions' documentation for details.
Use this function if you think you might someday switch your program from
using a set-associative container to a sequence container for storing result sets,
or vice versa.
See exec()(p. 126), execute()(p. 127), store()(p. 132), and use()(p. 137) for
alternative query execution mechanisms.

[Link]

template<class Sequence> void


mysqlpp::Query::storein_sequence (Sequence & con,
query_reset r = RESET_QUERY) [inline]

Execute a query, storing the result set in an STL sequence container.


This function works much like store()(p. 132) from the caller's perspective,
because it returns the entire result set at once. It's actually implemented in

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference

135

terms of use()(p. 137), however, so that memory for the result set doesn't need
to be allocated twice.
There are many overloads for this function, pretty much the same as for execute()(p. 127), except that there is a Container parameter at the front of the
list. So, you can pass a container and a query string, or a container and template
query parameters.

Parameters:

con any STL sequence container, such as std::vector


r whether the query automatically resets after being used

See also:
exec()(p. 126), execute()(p. 127), store()(p. 132), and use()(p. 137)
[Link]

template<class Set> void mysqlpp::Query::storein_set


(Set & con, query_reset r = RESET_QUERY) [inline]

Execute a query, storing the result set in an STL associative container.


The same thing as storein_sequence()(p. 134), except that it's used with
associative STL containers, such as std::set. Other than that detail, that
method's comments apply equally well to this one.

[Link]

std::string mysqlpp::Query::str (SQLQueryParms & p,


query_reset r)

Get built query as a null-terminated C++ string.

Parameters:

p
r

template query parameters to use, overriding the ones this object holds,
if any

if equal to RESET_QUERY, query object is cleared after this call

[Link]

std::string mysqlpp::Query::str (SQLQueryParms & p)

Get built query as a null-terminated C++ string.

Parameters:

template query parameters to use, overriding the ones this object holds,
if any

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

136

MySQL++ Class Documentation

[Link]

std::string mysqlpp::Query::str (query_reset r) [inline]

Get built query as a null-terminated C++ string.

Parameters:

if equal to RESET_QUERY, query object is cleared after this call

[Link]

std::string mysqlpp::Query::str (const SQLString & arg0)


[inline]

Get built query as a null-terminated C++ string with template query parameter
substitution.

Parameters:

arg0

[Link]

the value to substitute for the rst template query parameter

bool mysqlpp::Query::success ()

Returns true if the last operation succeeded.


Returns true if the last query succeeded, and the associated Connection(p. 58)
object's success()(p. 136) method also returns true. If either object is unhappy,
this method returns false.

[Link]

template<class T> Query& mysqlpp::Query::update


(const T & o, const T & n) [inline]

Replace an existing row's data with new data.


This function builds an UPDATE SQL query using the new row data for the
SET clause, and the old row data for the WHERE clause. One uses it with
MySQL++'s Specialized SQL Structures mechanism.

Parameters:

o
n

old row
new row

See also:
insert()(p. 129), replace()(p. 131)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.38 mysqlpp::Query Class Reference


[Link]

137

ResUse mysqlpp::Query::use (const char str, size_t len)

Execute query in a known-length C string.


Executes the query immediately, and returns an object that lets you walk
through the result set one row at a time, in sequence. This is more memoryecient than store()(p. 132).

[Link]

ResUse mysqlpp::Query::use (const char str)

Execute query in a C string.


Executes the query immediately, and returns an object that lets you walk
through the result set one row at a time, in sequence. This is more memoryecient than store()(p. 132).

[Link]

ResUse mysqlpp::Query::use (const SQLString & str)

Execute query in a C++ string.


Executes the query immediately, and returns an object that lets you walk
through the result set one row at a time, in sequence. This is more memoryecient than store()(p. 132).

[Link]

ResUse mysqlpp::Query::use () [inline]

Execute a query that can return a result set.


Use one of the use()(p. 137) overloads if memory eciency is important. They
return an object that can walk through the result records one by one, without
fetching the entire result set from the server. This is superior to store()(p. 132)
when there are a large number of results; store()(p. 132) would have to allocate
a large block of memory to hold all those records, which could cause problems.
A potential downside of this method is that MySQL database resources are tied
up until the result set is completely consumed. Do your best to walk through
the result set as expeditiously as possible.
The name of this method comes from the MySQL C API function that initiates
the retrieval process, mysql_use_result(). This method is implemented in
terms of that function.
This function has the same set of overloads as execute()(p. 127).

Returns:
ResUse(p. 142) object that can walk through result set serially

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

138

MySQL++ Class Documentation

See also:
exec()(p. 126), execute()(p. 127), store()(p. 132) and storein()(p. 134)

7.38.4 Member Data Documentation


[Link]

SQLQueryParms mysqlpp::Query::def

The default template parameters.


Used for lling in parameterized queries.
The documentation for this class was generated from the following les:
query.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.39 mysqlpp::ResNSel Class Reference

139

7.39 mysqlpp::ResNSel Class Reference


Holds the information on the success of queries that don't return any results.

#include <result.h>

Public Member Functions


ResNSel (Connection q)

Initialize object.
operator bool ()

Returns true if the query was successful.

Public Attributes
bool success

if true, query was successful


my_ulonglong insert_id

last value used for AUTO_INCREMENT eld


my_ulonglong rows

number of rows aected


std::string info

additional info about query result

7.39.1 Detailed Description


Holds the information on the success of queries that don't return any results.
The documentation for this class was generated from the following les:
result.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

140

MySQL++ Class Documentation

7.40 mysqlpp::Result Class Reference


This class manages SQL result sets.

#include <result.h>
Inheritance diagram
mysqlpp::Result:

for

mysqlpp::Result:Collaboration

diagram

for

Public Member Functions


Result ()

Default constructor.
Result (MYSQL_RES result, bool te=true)

Fully initialize object.


Result (const Result &other)

Initialize object as a copy of another Result(p. 140) object.


virtual Result ()

Destroy result set.


const Row fetch_row () const

Wraps mysql_fetch_row() in MySQL C API.


my_ulonglong num_rows () const

Wraps mysql_num_rows() in MySQL C API.


void data_seek (uint oset) const

Wraps mysql_data_seek() in MySQL C API.


size_type size () const

Alias for num_rows()(p. 140), only with dierent return type.


size_type rows () const

Alias for num_rows()(p. 140), only with dierent return type.


const Row at (size_type i) const

Get the row with an oset of i.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.40 mysqlpp::Result Class Reference

141

7.40.1 Detailed Description


This class manages SQL result sets.
Objects of this class are created to manage the result of "store" queries, where
the result set is handed to the program as single block of row data. (The name
comes from the MySQL C API function mysql_store_result() which creates
these blocks of row data.)
This class is a random access container (in the STL sense) which is neither
less-than comparable nor assignable. This container provides a reverse randomaccess iterator in addition to the normal forward one.

7.40.2 Member Function Documentation


[Link]

const Row mysqlpp::Result::fetch_row () const [inline]

Wraps mysql_fetch_row() in MySQL C API.


This is simply the const version of the same function in our parent class
(p. 142) . Why this cannot actually be in our parent class is beyond me.
The documentation for this class was generated from the following le:
result.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

142

MySQL++ Class Documentation

7.41 mysqlpp::ResUse Class Reference


A basic result set class, for use with "use" queries.

#include <result.h>
Inheritance diagram
mysqlpp::ResUse:

for

mysqlpp::ResUse:Collaboration

diagram

for

Public Member Functions


ResUse ()

Default constructor.
ResUse (MYSQL_RES result, Connection c=0, bool te=true)

Create the object, fully initialized.


ResUse (const ResUse &other)

Create a copy of another ResUse(p. 142) object.

virtual ResUse ()

Destroy object.
ResUse & operator= (const ResUse &other)

Copy another ResUse(p. 142) object's data into this object.

MYSQL_RES raw_result ()

Return raw MySQL C API result set.


Row fetch_row ()

Wraps mysql_fetch_row() in MySQL C API.


unsigned long fetch_lengths () const

Wraps mysql_fetch_lengths() in MySQL C API.


Field & fetch_eld () const

Wraps mysql_fetch_eld() in MySQL C API.


void eld_seek (int eld)

Wraps mysql_eld_seek() in MySQL C API.


int num_elds () const

Wraps mysql_num_elds() in MySQL C API.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.41 mysqlpp::ResUse Class Reference

void parent_leaving ()

Documentation needed!
void purge ()

Free all resources held by the object.


operator bool () const

Return true if we have a valid result set.


unsigned int columns () const

Return the number of columns in the result set.


std::string & table ()

Get the name of table that the result set comes from.
const std::string & table () const

Return the name of the table.


int eld_num (const std::string &) const

Get the index of the named eld.


std::string & eld_name (int)

Get the name of the eld at the given index.


const std::string & eld_name (int) const

Get the name of the eld at the given index.


FieldNames & eld_names ()

Get the names of the elds within this result set.


const FieldNames & eld_names () const

Get the names of the elds within this result set.


void reset_eld_names ()

Reset the names in the eld list to their original values.


mysql_type_info & eld_type (int i)

Get the MySQL type for a eld given its index.


const mysql_type_info & eld_type (int) const

Get the MySQL type for a eld given its index.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

143

144

MySQL++ Class Documentation

FieldTypes & eld_types ()

Get a list of the types of the elds within this result set.
const FieldTypes & eld_types () const

Get a list of the types of the elds within this result set.
void reset_eld_types ()

Reset the eld types to their original values.


int names (const std::string &s) const

Alias for eld_num()(p. 146).

std::string & names (int i)

Alias for eld_name()(p. 146).

const std::string & names (int i) const

Alias for eld_name()(p. 146).

FieldNames & names ()

Alias for eld_names()(p. 143).

const FieldNames & names () const

Alias for eld_names()(p. 143).

void reset_names ()

Alias for reset_eld_names()(p. 143).

mysql_type_info & types (int i)

Alias for eld_type()(p. 143).

const mysql_type_info & types (int i) const

Alias for eld_type()(p. 143).

FieldTypes & types ()

Alias for eld_types()(p. 144).

const FieldTypes & types () const

Alias for eld_types()(p. 144).

void reset_types ()

Alias for reset_eld_types()(p. 144).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.41 mysqlpp::ResUse Class Reference

145

const Fields & elds () const

Get the underlying Fields(p. 96) structure.

const Field & elds (unsigned int i) const

Get the underlying Field structure given its index.


bool operator== (const ResUse &other) const

Returns true if the other ResUse(p. 142) object shares the same underlying
C API result set as this one.

bool operator!= (const ResUse &other) const

Returns true if the other ResUse(p. 142) object has a dierent underlying C
API result set from this one.

Protected Member Functions


void copy (const ResUse &other)

Copy another ResUse(p. 142) object's contents into this one.

Protected Attributes
Connection conn_

server result set comes from


MYSQL_RES result_

underlying C API result set


bool initialized_

if true, object is fully initted


FieldNames names_

list of eld names in result


FieldTypes types_

list of eld types in result


Fields elds_

list of elds in result

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

146

MySQL++ Class Documentation

std::string table_

table result set comes from

7.41.1 Detailed Description


A basic result set class, for use with "use" queries.
A "use" query is one where you make the query and then process just one
row at a time in the result instead of dealing with them all as a single large
chunk. (The name comes from the MySQL C API function that initiates this
action, mysql_use_result().) By calling fetch_row()(p. 146) until it throws
a mysqlpp::BadQuery(p. 49) exception (or an empty row if exceptions are
disabled), you can process the result set one row at a time.

7.41.2 Member Function Documentation


[Link]

void mysqlpp::ResUse::copy (const ResUse & other)


[protected]

Copy another ResUse(p. 142) object's contents into this one.


Self-copy is not allowed.

[Link]

Row mysqlpp::ResUse::fetch_row () [inline]

Wraps mysql_fetch_row() in MySQL C API.


This is not a thin wrapper. It does a lot of error checking before returning the
mysqlpp::Row(p. 148) object containing the row data.

[Link]

std::string & mysqlpp::ResUse::eld_name (int)

Get the name of the eld at the given index.


This is the inverse of eld_num()(p. 146).

[Link]

int mysqlpp::ResUse::eld_num (const std::string &)


const

Get the index of the named eld.


This is the inverse of eld_name()(p. 146).

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.41 mysqlpp::ResUse Class Reference


[Link]

147

mysqlpp::ResUse::operator bool () const [inline]

Return true if we have a valid result set.


This operator is primarily used to determine if a query was successful:
Query q("....");
if ([Link]()) {
...

Query::use()(p. 137) returns a ResUse(p. 142) object, and it won't contain a


valid result set if the query failed.

[Link]

bool mysqlpp::ResUse::operator== (const ResUse &


other) const [inline]

Returns true if the other ResUse(p. 142) object shares the same underlying C
API result set as this one.
This works because the underlying result set is stored as a pointer, and thus
can be copied and then compared.

[Link]

void mysqlpp::ResUse::purge () [inline]

Free all resources held by the object.


This class's destructor is little more than a call to purge()(p. 147), so you can
think of this as a way to re-use a ResUse(p. 142) object, to avoid having to
completely re-create it.

[Link]

const std::string& mysqlpp::ResUse::table () const


[inline]

Return the name of the table.


This is only valid
The documentation for this class was generated from the following les:
result.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

148

MySQL++ Class Documentation

7.42 mysqlpp::Row Class Reference


Manages rows from a result set.

#include <row.h>
Inheritance
diagram
mysqlpp::Row:

for

mysqlpp::Row:Collaboration

diagram

for

Public Member Functions


Row ()

Default constructor.
Row (const MYSQL_ROW &d, const ResUse r, unsigned long jj, bool
te=true)

Create a row object.


Row ()

Destroy object.
const ResUse & parent () const

Get a reference to our parent class.


size_type size () const

Get the number of elds in the row.


const ColData operator[ ] (const char eld) const

Get the value of a eld given its name.


const ColData operator[ ] (size_type i) const

Get the value of a eld given its index.


const ColData at (size_type i) const

Get the value of a eld given its index.


const char raw_data (int i) const

Return the value of a eld as a C string given its index, in raw form.
std::string::size_type raw_size (int i) const

Return the size of a eld's raw data given its index.


const std::string & raw_string (int i) const

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference

149

Return the value of a eld as a C++ string given its index, in raw form.
operator bool () const

Returns true if there is data in the row.


template<class Manip> value_list_ba< Row, Manip > value_list
(const char d=",", Manip m=quote) const

Get a list of the values in this row.


template<class Manip> value_list_b< Row, Manip > value_list
(const char d, const std::vector< bool > &vb, Manip m=quote) const

Get a list of the values in this row.


value_list_b< Row, quote_type0 > value_list (const std::vector<
bool > &vb) const

Get a list of the values in this row.


template<class Manip> value_list_b< Row, 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

Get a list of the values in this row.


value_list_b< Row, 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

Get a list of the values in this row.


value_list_b< Row, 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

Get a list of the values in this row.


template<class Manip> value_list_b< Row, Manip > value_list
(const char d, Manip m, std::string s0, std::string s1="", std::string
s2="", std::string s3="", std::string s4="", std::string s5="", std::string
s6="", std::string s7="", std::string s8="", std::string s9="", std::string
sa="", std::string sb="", std::string sc="") const

Get a list of the values in this row.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

150

MySQL++ Class Documentation

value_list_b< Row, quote_type0 > value_list (const char d,


std::string s0, std::string s1="", std::string s2="", std::string s3="",
std::string s4="", std::string s5="", std::string s6="", std::string s7="",
std::string s8="", std::string s9="", std::string sa="", std::string sb="",
std::string sc="") const

Get a list of the values in this row.


value_list_b< Row, quote_type0 > value_list (std::string s0,
std::string s1="", std::string s2="", std::string s3="", std::string s4="",
std::string s5="", std::string s6="", std::string s7="", std::string s8="",
std::string s9="", std::string sa="", std::string sb="", std::string sc="")
const

Get a list of the values in this row.


value_list_ba< FieldNames, do_nothing_type0 > eld_list
(const char d=",") const

Get a list of the eld names in this row.


template<class Manip> value_list_ba< FieldNames, Manip >
eld_list (const char d, Manip m) const

Get a list of the eld names in this row.


template<class Manip> value_list_b< FieldNames, Manip >
eld_list (const char d, Manip m, const std::vector< bool > &vb)
const

Get a list of the eld names in this row.


value_list_b< FieldNames, quote_type0 > eld_list (const char
d, const std::vector< bool > &vb) const

Get a list of the eld names in this row.


value_list_b< FieldNames, quote_type0 > eld_list (const
std::vector< bool > &vb) const

Get a list of the eld names in this row.


template<class Manip> value_list_b< FieldNames, Manip >
eld_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

Get a list of the eld names in this row.


value_list_b< FieldNames, quote_type0 > eld_list (const char
d, bool t0, bool t1=false, bool t2=false, bool t3=false, bool t4=false,

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference

151

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

Get a list of the eld names in this row.


value_list_b< FieldNames, quote_type0 > eld_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

Get a list of the eld names in this row.


equal_list_ba< FieldNames, Row, quote_type0 > equal_list
(const char d=",", const char e="=") const

Get an "equal list" of the elds and values in this row.


template<class Manip> equal_list_ba< FieldNames, Row, Manip
> equal_list (const char d, const char e, Manip m) const

Get an "equal list" of the elds and values in this row.

7.42.1 Detailed Description


Manages rows from a result set.

7.42.2 Constructor & Destructor Documentation


[Link]

mysqlpp::Row::Row (const MYSQL_ROW & d, const


ResUse r, unsigned long jj, bool te = true)

Create a row object.

Parameters:

d MySQL C API row data


r result set that the row comes from
jj length of each item in d
te if true, throw exceptions on errors

7.42.3 Member Function Documentation


[Link]

const ColData mysqlpp::Row::at (size_type i) const

Get the value of a eld given its index.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

152

MySQL++ Class Documentation

If the index value is bad, the underlying std::vector is supposed to throw an


exception, according to the Standard.
For this function to work, the Result(p. 140) or ResUse(p. 142) object that
created this object must still exist. In other words, you cannot re-use or destroy
the result object until you are done retrieving data from this row object.
See operator[ ](const char) for more caveats.

[Link]

template<class Manip> equal_list_ba< FieldNames,


Row, Manip > mysqlpp::Row::equal_list (const char d,
const char e, Manip m) const

Get an "equal list" of the elds and values in this row.


This method's parameters govern how the returned list will behave when you
insert it into a C++ stream:

Parameters:

d delimiter to use between items


e the operator to use between elements
m the manipulator to use for each element

For example, if d is ",", e is " = ", and m is the quote manipulator, then the
eld and value lists (a, b) (c, d'e) will yield an equal list that gives the following
when inserted into a C++ stream:
'a' = 'c', 'b' = 'd''e'

Notice how the single quote was 'escaped' in the SQL way to avoid a syntax
error.

[Link]

equal_list_ba< FieldNames, Row, quote_type0 >


mysqlpp::Row::equal_list (const char d = ",", const char
e = "=") const

Get an "equal list" of the elds and values in this row.


When inserted into a C++ stream, the delimiter 'd' will be used between the
items, " = " is the relationship operator, and items will be quoted and escaped.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference


[Link]

153

value_list_b< FieldNames, quote_type0 >


mysqlpp::Row::eld_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

Get a list of the eld names in this row.


For each true parameter, the eld name in that position within the row is added
to the returned list. When the list is inserted into a C++ stream, a comma will
be placed between the items as a delimiter, and the items will be quoted and
escaped.

[Link]

value_list_b< FieldNames, quote_type0 >


mysqlpp::Row::eld_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

Get a list of the eld names in this row.


For each true parameter, the eld name in that position within the row is added
to the returned list. When the list is inserted into a C++ stream, the delimiter
'd' will be placed between the items as a delimiter, and the items will be quoted
and escaped.

[Link]

template<class Manip> value_list_b< FieldNames,


Manip > mysqlpp::Row::eld_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

Get a list of the eld names in this row.


For each true parameter, the eld name in that position within the row is added
to the returned list. When the list is inserted into a C++ stream, the delimiter
'd' will be placed between the items as a delimiter, and the manipulator 'm'
used before each item.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

154

MySQL++ Class Documentation

[Link]

value_list_b< FieldNames, quote_type0 >


mysqlpp::Row::eld_list (const std::vector< bool > & vb)
const

Get a list of the eld names in this row.

Parameters:

vb

for each true item in this list, add that eld name to the returned list;
ignore the others

Field names will be quoted and escaped when inserted into a C++ stream, and
a comma will be placed between them as a delimiter.

[Link]

value_list_b< FieldNames, quote_type0 >


mysqlpp::Row::eld_list (const char d, const
std::vector< bool > & vb) const

Get a list of the eld names in this row.

Parameters:

delimiter to place between the items when the list is inserted into a C++
stream

vb

for each true item in this list, add that eld name to the returned list;
ignore the others

Field names will be quoted and escaped when inserted into a C++ stream.

[Link]

template<class Manip> value_list_b< FieldNames,


Manip > mysqlpp::Row::eld_list (const char d, Manip
m, const std::vector< bool > & vb) const

Get a list of the eld names in this row.

Parameters:

delimiter to place between the items when the list is inserted into a C++
stream

manipulator to use before each item when the list is inserted into a C++
stream

vb

for each true item in this list, add that eld name to the returned list;
ignore the others

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference


[Link]

155

template<class Manip> value_list_ba< FieldNames,


Manip > mysqlpp::Row::eld_list (const char d, Manip
m) const

Get a list of the eld names in this row.

Parameters:

delimiter to place between the items when the list is inserted into a C++
stream
manipulator to use before each item when the list is inserted into a C++
stream

[Link]

value_list_ba< FieldNames, do_nothing_type0 >


mysqlpp::Row::eld_list (const char d = ",") const

Get a list of the eld names in this row.


When inserted into a C++ stream, the delimiter 'd' will be used between the
items, and no manipulator will be used on the items.

[Link]

const ColData mysqlpp::Row::operator[ ] (size_type i)


const [inline]

Get the value of a eld given its index.


This function is just syntactic sugar, wrapping the at()(p. 151) method. The
at()(p. 151) method is the only way to get at the rst eld in a result set by
index, as row[0] is ambiguous: it could call either operator[] overload.

See also:
at()(p. 151) for the full documentation for this operator,

operator[ ](const char) for further caveats about using this operator.

[Link]

and

const ColData mysqlpp::Row::operator[ ] (const char


eld) const

Get the value of a eld given its name.


If the eld does not exist in this row, we throw a BadFieldName(p. 45) exception.
For this operator to work, the Result(p. 140) or ResUse(p. 142) object that
created this object must still exist. In other words, you cannot re-use or destroy
the result object until you are done retrieving data from this row object.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

156

MySQL++ Class Documentation

Note that we return the ColData (p. 52) object by value. The purpose of ColData is to make it easy to convert the string data returned by the MySQL server
to some more appropriate type, so you're almost certain to use this operator in
a construct like this:
string s = row["myfield"];

That accesses myeld within the row, returns a temporary ColData object,
which is then automatically converted to a std::string and copied into s.
That works ne, but beware of this similar but incorrect construct:
const char* pc = row["myfield"];

This one line of code does what you expect, but pc is then a dangling pointer:
it points to memory owned by the temporary ColData object, which will have
been destroyed by the time you get around to actually using the pointer.
This function is rather inecient. If that is a concern for you, use at()(p. 151),
operator[ ](size_type) or the SSQLS mechanism' instead.

[Link]

const char mysqlpp::Row::raw_data (int i) const


[inline]

Return the value of a eld as a C string given its index, in raw form.
This is the same thing as operator[], except that the data isn't converted to a
ColData object rst. Also, this method does not check for out-of-bounds array
indices.

[Link]

const std::string& mysqlpp::Row::raw_string (int i)


const [inline]

Return the value of a eld as a C++ string given its index, in raw form.
This is the same thing as operator[], except that the data isn't converted to a
ColData object rst.

[Link]

value_list_b<Row, quote_type0>
mysqlpp::Row::value_list (std::string s0, std::string s1 =
"", std::string s2 = "", std::string s3 = "", std::string s4
= "", std::string s5 = "", std::string s6 = "", std::string
s7 = "", std::string s8 = "", std::string s9 = "",
std::string sa = "", std::string sb = "", std::string sc =
"") const [inline]

Get a list of the values in this row.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference

157

The 's' parameters name the elds that will be added to the returned list. When
inserted into a C++ stream, a comma will be placed between the items as a
delimiter, and items will be quoted and escaped.

[Link]

value_list_b<Row, quote_type0>
mysqlpp::Row::value_list (const char d, std::string s0,
std::string s1 = "", std::string s2 = "", std::string s3 =
"", std::string s4 = "", std::string s5 = "", std::string s6
= "", std::string s7 = "", std::string s8 = "", std::string
s9 = "", std::string sa = "", std::string sb = "",
std::string sc = "") const [inline]

Get a list of the values in this row.


The 's' parameters name the elds that will be added to the returned list. When
inserted into a C++ stream, the delimiter 'd' will be placed between the items,
and items will be quoted and escaped.

[Link]

template<class Manip> value_list_b<Row, Manip>


mysqlpp::Row::value_list (const char d, Manip m,
std::string s0, std::string s1 = "", std::string s2 = "",
std::string s3 = "", std::string s4 = "", std::string s5 =
"", std::string s6 = "", std::string s7 = "", std::string s8
= "", std::string s9 = "", std::string sa = "", std::string
sb = "", std::string sc = "") const [inline]

Get a list of the values in this row.


The 's' parameters name the elds that will be added to the returned list. When
inserted into a C++ stream, the delimiter 'd' will be placed between the items,
and the manipulator 'm' will be inserted before each item.

[Link]

value_list_b<Row, quote_type0>
mysqlpp::Row::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 [inline]

Get a list of the values in this row.


For each true parameter, the value in that position within the row is added to
the returned list. When the list is inserted into a C++ stream, the a comma
will be placed between the items, as a delimiter, and items will be quoted and
escaped.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

158

MySQL++ Class Documentation

[Link]

value_list_b<Row, quote_type0>
mysqlpp::Row::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 [inline]

Get a list of the values in this row.


For each true parameter, the value in that position within the row is added to
the returned list. When the list is inserted into a C++ stream, the delimiter 'd'
will be placed between the items, and items will be quoted and escaped.

[Link]

template<class Manip> value_list_b<Row, Manip>


mysqlpp::Row::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 [inline]

Get a list of the values in this row.


For each true parameter, the value in that position within the row is added to
the returned list. When the list is inserted into a C++ stream, the delimiter
'd' will be placed between the items, and the manipulator 'm' used before each
item.

[Link]

value_list_b<Row, quote_type0>
mysqlpp::Row::value_list (const std::vector< bool > &
vb) const [inline]

Get a list of the values in this row.

Parameters:

vb

for each true item in this list, add that value to the returned list; ignore
the others

Items will be quoted and escaped when inserted into a C++ stream, and a
comma will be used as a delimiter between the items.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.42 mysqlpp::Row Class Reference


[Link]

159

template<class Manip> value_list_b<Row, Manip>


mysqlpp::Row::value_list (const char d, const
std::vector< bool > & vb, Manip m = quote) const
[inline]

Get a list of the values in this row.

Parameters:

d delimiter to use between values


vb for each true item in this list, add that value to the returned list; ignore
m

the others

manipulator to use when inserting values into a stream

[Link]

template<class Manip> value_list_ba<Row, Manip>


mysqlpp::Row::value_list (const char d = ",", Manip m
= quote) const [inline]

Get a list of the values in this row.


When inserted into a C++ stream, the delimiter 'd' will be used between the
items, and the quoting and escaping rules will be set by the manipulator 'm'
you choose.

Parameters:

d delimiter to use between values


m manipulator to use when inserting values into a stream

The documentation for this class was generated from the following les:
row.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

160

MySQL++ Class Documentation

7.43 mysqlpp::scoped_var_set< T > Class Template Reference


Sets a variable to a given value temporarily.
Collaboration diagram for mysqlpp::scoped_var_set< T >:

Public Member Functions


scoped_var_set (T &var, T new_value)

Create object, saving old value, setting new value.


scoped_var_set ()

Destroy object, restoring old value.

7.43.1 Detailed Description


template<class T> class mysqlpp::scoped_var_set< T >
Sets a variable to a given value temporarily.
Saves existing value, sets new value, and restores old value when the object is
destroyed. Used to set a ag in an exception-safe manner.
The documentation for this class was generated from the following le:
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.44 mysqlpp::Set< Container > Class Template Reference

161

7.44 mysqlpp::Set< Container > Class Template


Reference
A special std::set derivative for holding MySQL data sets.

#include <myset.h>

Public Member Functions


Set ()

Default constructor.
Set (const char str)

Create object from a comma-separated list of values.


Set (const std::string &str)

Create object from a comma-separated list of values.


Set (const ColData &str)

Create object from a comma-separated list of values.


std::ostream & out_stream (std::ostream &s) const

Insert this set's data into a C++ stream in comma-separated format.


operator std::string ()

Convert this set's data to a string containing comma-separated items.

7.44.1 Detailed Description


template<class
Container
mysqlpp::Set< Container >

std::set<std::string>>

A special std::set derivative for holding MySQL data sets.


The documentation for this class was generated from the following le:
myset.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

class

162

MySQL++ Class Documentation

7.45 mysqlpp::SQLParseElement Struct Reference


Used within Query(p. 121) to hold elements for parameterized queries.

#include <qparms.h>

Public Member Functions


SQLParseElement (std::string b, char o, signed char n)

Create object.

Public Attributes
std::string before

string inserted before the parameter


char option

the parameter option, or blank if none


signed char num

the parameter position to use

7.45.1 Detailed Description


Used within Query(p. 121) to hold elements for parameterized queries.
Each element has three parts:
The concept behind the before variable needs a little explaining. When a
template query is parsed, each parameter is parsed into one of these SQLParseElement(p. 162) objects, but the non-parameter parts of the template also have
to be stored somewhere. MySQL++ chooses to attach the text leading up to a
parameter to that parameter. So, the before string is simply the text copied
literally into the nished query before we insert a value for the parameter.
The option character is currently one of 'q', 'Q', 'r', 'R' or ' '. See the "Template
Queries" chapter in the user manual for details.
The position value (num) allows a template query to have its parameters in a
dierent order than in the Query(p. 121) method call. An example of how this
can be helpful is in the "Template Queries" chapter of the user manual.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.45 mysqlpp::SQLParseElement Struct Reference

7.45.2 Constructor & Destructor Documentation


[Link]

mysqlpp::SQLParseElement::SQLParseElement
(std::string b, char o, signed char n) [inline]

Create object.

Parameters:

b the 'before' value


o the 'option' value
n the 'num' value

The documentation for this struct was generated from the following le:
qparms.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

163

164

MySQL++ Class Documentation

7.46 mysqlpp::SQLQueryParms Class Reference


This class holds the parameter values for lling template queries.

#include <qparms.h>
Collaboration diagram for mysqlpp::SQLQueryParms:

Public Types
typedef const SQLString & ss

Abbreviation so some of the declarations below don't span many lines.

Public Member Functions


SQLQueryParms ()

Default constructor.
SQLQueryParms (Query p)

Create object.
bool bound ()

Returns true if we are bound to a query object.


void clear ()

Clears the list.


SQLString & operator[ ] (size_type n)

Access element number n.


const SQLString & operator[ ] (size_type n) const

Access element number n.


SQLString & operator[ ] (const char str)

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


const SQLString & operator[ ] (const char str) const

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


SQLQueryParms & operator<< (const SQLString &str)

Adds an element to the list.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.46 mysqlpp::SQLQueryParms Class Reference

165

SQLQueryParms & operator+= (const SQLString &str)

Adds an element to the list.


SQLQueryParms operator+ (const SQLQueryParms &other)
const

Build a composite of two parameter lists.


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)

Set(p. 161) the template query parameters.

Friends
class Query

7.46.1 Detailed Description


This class holds the parameter values for lling template queries.

7.46.2 Constructor & Destructor Documentation


[Link]

mysqlpp::SQLQueryParms::SQLQueryParms (Query p)
[inline]

Create object.

Parameters:

pointer to the query object these parameters are tied to

7.46.3 Member Function Documentation


[Link]

bool mysqlpp::SQLQueryParms::bound () [inline]

Returns true if we are bound to a query object.


Basically, this tells you which of the two ctors were called.

[Link]

SQLQueryParms mysqlpp::SQLQueryParms::operator+
(const SQLQueryParms & other) const

Build a composite of two parameter lists.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

166

MySQL++ Class Documentation

If this list is (a, b) and other is (c, d, e, f, g), then the returned list will be (a,
b, e, f, g). That is, all of this list's parameters are in the returned list, plus any
from the other list that are in positions beyond what exist in this list.
If the two lists are the same length or this list is longer than the other list, a
copy of this list is returned.

[Link]

void mysqlpp::SQLQueryParms::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) [inline]

Set(p. 161) the template query parameters.


Sets parameter 0 to a, parameter 1 to b, etc. There are overloaded versions of
this function that take anywhere from one to a dozen parameters.
The documentation for this class was generated from the following les:
qparms.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.47 mysqlpp::SQLString Class Reference

7.47 mysqlpp::SQLString Class Reference


A specialized std::string that will convert from any valid MySQL type.

#include <sql_string.h>

Public Member Functions


SQLString ()

Default constructor; empty string.

SQLString (const std::string &str)

Create object as a copy of a C++ string.

SQLString (const char str)

Create object as a copy of a C string.

SQLString (const char str, size_t len)

Create object as a copy of a known-length string of characters.

SQLString (char i)

Create object as the string form of a char value.

SQLString (unsigned char i)

Create object as the string form of an unsigned char value.

SQLString (short int i)

Create object as the string form of a short int value.

SQLString (unsigned short int i)

Create object as the string form of an unsigned short int value.

SQLString (int i)

Create object as the string form of an int value.

SQLString (unsigned int i)

Create object as the string form of an unsigned int value.

SQLString (longlong i)

Create object as the string form of a longlong value.

SQLString (ulonglong i)

Create object as the string form of an unsigned longlong value.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

167

168

MySQL++ Class Documentation

SQLString (oat i)

Create object as the string form of a float value.


SQLString (double i)

Create object as the string form of a double value.


SQLString (const null_type &i)

Create object representing NULL.


SQLString & operator= (const char str)

Copy a C string into this object.


SQLString & operator= (const std::string &str)

Copy a C++ string into this object.

Public Attributes
bool is_string

If true, the object's string data is a copy of another string. Otherwise, it's
the string form of an integral type.
bool dont_escape

If true, the string data doesn't need to be SQL-escaped when building a query.
bool processed

If true, one of the MySQL++ manipulators has processed the string data.

7.47.1 Detailed Description


A specialized std::string that will convert from any valid MySQL type.

7.47.2 Member Data Documentation


[Link]

bool mysqlpp::SQLString::processed

If true, one of the MySQL++ manipulators has processed the string data.
"Processing" is escaping special SQL characters, and/or adding quotes. See the
documentation for manip.h(p. 197) for details.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.47 mysqlpp::SQLString Class Reference

169

This ag is used by the template query mechanism, to prevent a string from
being re-escaped or re-quoted each time that query is reused. The ag is reset
by operator=, to force the new parameter value to be re-processed.
The documentation for this class was generated from the following les:
sql_string.h
sql_string.cpp

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

170

MySQL++ Class Documentation

7.48 mysqlpp::subscript_iterator<
OnType,
ReturnType, SizeType, DiType > Class
Template Reference
Iterator that can be subscripted.

#include <resiter.h>
Collaboration diagram for mysqlpp::subscript_iterator< OnType, ReturnType,
SizeType, DiType >:

Public Member Functions


subscript_iterator ()

Default constructor.
subscript_iterator (OnType what, SizeType pos)

Create iterator given the container and a position within it.


bool operator== (const subscript_iterator &j) const

Return true if given iterator points to the same container and the same position within the container.
bool operator!= (const subscript_iterator &j) const

Return true if given iterator is dierent from this one, but points to the same
container.
bool operator< (const subscript_iterator &j) const

Return true if the given iterator points to the same container as this one,
and that this iterator's position is less than the given iterator's.
bool operator> (const subscript_iterator &j) const

Return true if the given iterator points to the same container as this one,
and that this iterator's position is greater than the given iterator's.
bool operator<= (const subscript_iterator &j) const

Return true if the given iterator points to the same container as this one,
and that this iterator's position is less than or equal to the given iterator's.
bool operator>= (const subscript_iterator &j) const

Return true if the given iterator points to the same container as this one, and
that this iterator's position is greater than or equal to the given iterator's.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.48 mysqlpp::subscript_iterator< OnType, ReturnType, SizeType,


DiType > Class Template Reference
171
ReturnType operator () const

Dereference the iterator, returning a copy of the pointed-to element within


the container.
ReturnType operator[ ] (SizeType n) const

Return a copy of the element at the given position within the container.
subscript_iterator & operator++ ()

Move the iterator to the next element, returning an iterator to that element.
subscript_iterator operator++ (int)

Move the iterator to the next element, returning an iterator to the element
we were pointing at before the change.
subscript_iterator & operator ()

Move the iterator to the previous element, returning an iterator to that element.
subscript_iterator operator (int)

Move the iterator to the previous element, returning an iterator to the element we were pointing at before the change.
subscript_iterator & operator+= (SizeType n)

Advance iterator position by n.


subscript_iterator operator+ (SizeType n) const

Return an iterator n positions beyond this one.


subscript_iterator & operator-= (SizeType n)

Move iterator position back by n.


subscript_iterator operator- (SizeType n) const

Return an iterator n positions before this one.


DiType operator- (const subscript_iterator &j) const

Return an iterator n positions before this one.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

172

MySQL++ Class Documentation

7.48.1 Detailed Description


template<class OnType, class ReturnType, class SizeType, class
DiType> class mysqlpp::subscript_iterator< OnType, ReturnType,
SizeType, DiType >
Iterator that can be subscripted.
This is the type of iterator used by the const_subscript_container(p. 75)
template.
The documentation for this class was generated from the following le:
resiter.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.49 mysqlpp::Time Struct Reference

173

7.49 mysqlpp::Time Struct Reference


C++ form of MySQL's TIME type.

#include <datetime.h>
Inheritance diagram
mysqlpp::Time:

for

mysqlpp::Time:Collaboration

diagram

Public Member Functions


Time ()

Default constructor.
Time (tiny_int h, tiny_int m, tiny_int s)

Initialize object.
Time (const Time &other)

Initialize object as a copy of another Time(p. 173).

Time (const DateTime &other)

Initialize object from time part of date/time object.


Time (cchar str)

Initialize object from a MySQL time string.


Time (const ColData &str)

Initialize object from a MySQL time string.


Time (const std::string &str)

Initialize object from a MySQL time string.


MYSQLPP_EXPORT cchar convert (cchar )

Parse a MySQL time string into this object.


MYSQLPP_EXPORT short int compare (const Time &other) const

Compare this time to another.

Public Attributes
tiny_int hour

hour, 0-23

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

for

174

MySQL++ Class Documentation

tiny_int minute

minute, 0-59

tiny_int second

second, 0-59

7.49.1 Detailed Description


C++ form of MySQL's TIME type.
Objects of this class can be inserted into streams, and initialized from MySQL
TIME strings.

7.49.2 Constructor & Destructor Documentation


[Link]

mysqlpp::Time::Time (cchar str) [inline]

Initialize object from a MySQL time string.


String must be in the HH:MM:SS format. It doesn't have to be zero-padded.

[Link]

mysqlpp::Time::Time (const ColData & str) [inline]

Initialize object from a MySQL time string.

See also:
Time(cchar)(p. 174)
[Link]

mysqlpp::Time::Time (const std::string & str) [inline]

Initialize object from a MySQL time string.

See also:
Time(cchar)(p. 174)

7.49.3 Member Function Documentation


[Link]

short int mysqlpp::Time::compare (const Time & other)


const [virtual]

Compare this time to another.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.49 mysqlpp::Time Struct Reference

175

Returns < 0 if this time is before the other, 0 of they are equal, and > 0 if this
time is after the other.
Implements mysqlpp::DTbase< Time > (p. 86).
The documentation for this struct was generated from the following les:
datetime.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

176

MySQL++ Class Documentation

7.50 mysqlpp::tiny_int Class Reference


Class for holding an SQL tiny_int(p. 176) object.

#include <tiny_int.h>

Public Member Functions


tiny_int ()

Default constructor.

tiny_int (short int v)

Create object from any integral type that can be converted to a short int.

operator short int () const

Return value as a short int.

tiny_int & operator= (short int v)

Assign a short int to the object.

tiny_int & operator+= (short int v)

Add another value to this object.

tiny_int & operator-= (short int v)

Subtract another value to this object.

tiny_int & operator = (short int v)

Multiply this value by another object.

tiny_int & operator/= (short int v)

Divide this value by another object.

tiny_int & operator%= (short int v)

Divide this value by another object and store the remainder.

tiny_int & operator &= (short int v)

Bitwise AND this value by another value.

tiny_int & operator|= (short int v)

Bitwise OR this value by another value.

tiny_int & operator = (short int v)

Bitwise XOR this value by another value.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.50 mysqlpp::tiny_int Class Reference

tiny_int & operator<<= (short int v)

Shift this value left by v positions.


tiny_int & operator>>= (short int v)

Shift this value right by v positions.


tiny_int & operator++ ()

Add one to this value and return that value.


tiny_int & operator ()

Subtract one from this value and return that value.


tiny_int operator++ (int)

Add one to this value and return the previous value.


tiny_int operator (int)

Subtract one from this value and return the previous value.
tiny_int operator- (const tiny_int &i) const

Return this value minus i.


tiny_int operator+ (const tiny_int &i) const

Return this value plus i.


tiny_int operator (const tiny_int &i) const

Return this value multiplied by i.


tiny_int operator/ (const tiny_int &i) const

Return this value divided by i.


tiny_int operator% (const tiny_int &i) const

Return the modulus of this value divided by i.


tiny_int operator| (const tiny_int &i) const

Return this value bitwise OR'd by i.


tiny_int operator & (const tiny_int &i) const

Return this value bitwise AND'd by i.


tiny_int operator (const tiny_int &i) const

Return this value bitwise XOR'd by i.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

177

178

MySQL++ Class Documentation

tiny_int operator<< (const tiny_int &i) const

Return this value bitwise shifted left by i.


tiny_int operator>> (const tiny_int &i) const

Return this value bitwise shifted right by i.

7.50.1 Detailed Description


Class for holding an SQL tiny_int(p. 176) object.
This is required because the closest C++ type, char, doesn't have all the right
semantics. For one, inserting a char into a stream won't give you a number.
Several of the functions below accept a short int argument, but internally we
store the data as a char. Beware of integer overows!

7.50.2 Constructor & Destructor Documentation


[Link]

mysqlpp::tiny_int::tiny_int () [inline]

Default constructor.
Value is uninitialized
The documentation for this class was generated from the following le:
tiny_int.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.51 mysqlpp::Transaction Class Reference

179

7.51 mysqlpp::Transaction Class Reference


Helper object for creating exception-safe SQL transactions.

#include <transaction.h>
Collaboration diagram for mysqlpp::Transaction:

Public Member Functions


Transaction (Connection &conn, bool consistent=false)

Constructor.
Transaction ()

Destructor.
void commit ()

Commits the transaction.


void rollback ()

Rolls back the transaction.

7.51.1 Detailed Description


Helper object for creating exception-safe SQL transactions.

7.51.2 Constructor & Destructor Documentation


[Link]

Transaction::Transaction (Connection & conn, bool


consistent = false)

Constructor.

Parameters:

conn The connection we use to manage the transaction set


consistent Whether to use "consistent snapshots" during the transaction.
See the documentation for "START TRANSACTION" in the MySQL
manual for more on this.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

180
[Link]

MySQL++ Class Documentation


Transaction::Transaction ()

Destructor.
If the transaction has not been committed or rolled back by the time the destructor is called, it is rolled back. This is the right thing because one way this
can happen is if the object is being destroyed as the stack is unwound to handle
an exception. In that instance, you certainly want to roll back the transaction.

7.51.3 Member Function Documentation


[Link]

void Transaction::commit ()

Commits the transaction.


This commits all updates to the database using the connection we were created
with since this object was created. This is a no-op if the table isn't stored
using a transaction-aware storage engine. See CREATE TABLE in the MySQL
manual for details.

[Link]

void Transaction::rollback ()

Rolls back the transaction.


This abandons all SQL statements made on the connection since this object
was created. This only works on tables stored using a transaction-aware storage
engine. See CREATE TABLE in the MySQL manual for details.
The documentation for this class was generated from the following les:
transaction.h
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.52 mysqlpp::value_list_b< Seq, Manip > Struct Template


Reference

7.52 mysqlpp::value_list_b< Seq, Manip


Struct Template Reference

181

>

Same as value_list_ba(p. 183), plus the option to have some elements of the
list suppressed.

#include <vallist.h>
Collaboration diagram for mysqlpp::value_list_b< Seq, Manip >:

Public Member Functions


value_list_b (const Seq &s, const std::vector< bool > &f, const char
d, Manip m)

Create object.

Public Attributes
const Seq list

set of objects in the value list


const std::vector< bool > elds

delimiter to use between each value in the list when inserting it into a C++
stream
const char delem

delimiter to use between each value in the list when inserting it into a C++
stream
Manip manip

manipulator to use when inserting the list into a C++ stream

7.52.1 Detailed Description


template<class Seq, class Manip> struct mysqlpp::value_list_b<
Seq, Manip >
Same as value_list_ba(p. 183), plus the option to have some elements of the
list suppressed.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

182

MySQL++ Class Documentation

Imagine an object of this type contains the list (a, b, c), that the object's 'elds'
list is (true, false, true), and that the object's delimiter is set to ":". When you
insert that object into a C++ stream, you would get "a:c".
See value_list_ba's documentation for more details.

7.52.2 Constructor & Destructor Documentation


[Link]

template<class Seq, class Manip> mysqlpp::value_list_b<


Seq, Manip >::value_list_b (const Seq & s, const
std::vector< bool > & f, const char d, Manip m)
[inline]

Create object.

Parameters:

s
f

set of objects in the value list

for each true item in the list, the list item in that position will be inserted
into a C++ stream

what delimiter to use between each value in the list when inserting the
list into a C++ stream
manipulator to use when inserting the list into a C++ stream

The documentation for this struct was generated from the following le:
vallist.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

7.53 mysqlpp::value_list_ba< Seq, Manip > Struct Template


Reference

7.53 mysqlpp::value_list_ba< Seq, Manip


Struct Template Reference

183

>

Holds a list of items, typically used to construct a SQL "value list".

#include <vallist.h>
Collaboration diagram for mysqlpp::value_list_ba< Seq, Manip >:

Public Member Functions


value_list_ba (const Seq &s, const char d, Manip m)

Create object.

Public Attributes
const Seq list

set of objects in the value list


const char delem

delimiter to use between each value in the list when inserting it into a C++
stream
Manip manip

manipulator to use when inserting the list into a C++ stream

7.53.1 Detailed Description


template<class Seq, class Manip> struct mysqlpp::value_list_ba<
Seq, Manip >
Holds a list of items, typically used to construct a SQL "value list".
The SQL INSERT statement has a VALUES clause; this class can be used to
construct the list of items for that clause.
Imagine an object of this type contains the list (a, b, c), and that the object's
delimiter symbol is set to ", ". When you insert that object into a C++ stream,
you would get "a, b, c".
This class is never instantiated by hand. The value_list()(p. 38) functions
build instances of this structure template to do their work. MySQL++'s SSQLS
mechanism calls those functions when building SQL queries; you can call them

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

184

MySQL++ Class Documentation

yourself to do similar work. The "Harnessing SSQLS Internals" section of the


user manual has some examples of this.

See also:
value_list_b(p. 181)

7.53.2 Constructor & Destructor Documentation


[Link]

template<class Seq, class Manip> mysqlpp::value_list_ba< Seq, Manip >::value_list_ba (const Seq & s, const
char d, Manip m) [inline]

Create object.

Parameters:

s set of objects in the value list


d what delimiter to use between each value in the list when inserting the
m

list into a C++ stream

manipulator to use when inserting the list into a C++ stream

The documentation for this struct was generated from the following le:
vallist.h

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Chapter 8

MySQL++ File
Documentation
8.1 autoag.h File Reference
Denes a template for setting a ag within a given variable scope, and resetting
it when exiting that scope.

Classes
class AutoFlag

A template for setting a ag on a variable as long as the object that set it is
in scope. Flag resets when object goes out of scope. Works on anything that
looks like bool.

8.1.1 Detailed Description


Denes a template for setting a ag within a given variable scope, and resetting
it when exiting that scope.

186

MySQL++ File Documentation

8.2 coldata.h File Reference


Declares classes for converting string data to any of the basic C types.

#include "common.h"
#include "const_string.h"
#include "convert.h"
#include "exceptions.h"
#include "null.h"
#include "string_util.h"
#include "type_info.h"
#include <typeinfo>
#include <string>
#include <sstream>
#include <stdlib.h>
Include dependency graph for coldata.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.2.1 Detailed Description


Declares classes for converting string data to any of the basic C types.
Roughly

speaking,

this

denes

mysqlpp::SQLString(p. 167).

classes

that

are

the

inverse

of

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.3 common.h File Reference

187

8.3 common.h File Reference


This le includes top-level denitions for use both internal to the library, and
outside it. Contrast mysql++.h.

#include <mysql.h>
Include dependency graph for common.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.3.1 Detailed Description


This le includes top-level denitions for use both internal to the library, and
outside it. Contrast mysql++.h.
This le mostly takes care of platform dierences.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

188

MySQL++ File Documentation

8.4 connection.h File Reference


Declares the Connection class.

#include "common.h"
#include "lockable.h"
#include "noexceptions.h"
#include <deque>
#include <string>
Include dependency graph for connection.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.4.1 Detailed Description


Declares the Connection class.
Every program using MySQL++ must create a Connection object, which manages information about the connection to the MySQL database, and performs
connection-related operations once the connection is up. Subordinate classes,
such as Query and Row take their defaults as to whether exceptions are thrown
when errors are encountered from the Connection object that created them,
directly or indirectly.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.5 const_string.h File Reference

189

8.5 const_string.h File Reference


Declares a wrapper for const char which behaves in a way more useful to
MySQL++.

#include "common.h"
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <string>
Include dependency graph for const_string.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.5.1 Detailed Description


Declares a wrapper for const char which behaves in a way more useful to
MySQL++.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

190

MySQL++ File Documentation

8.6 convert.h File Reference


Declares various string-to-integer type conversion templates.

#include "common.h"
#include <stdlib.h>
Include dependency graph for convert.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.6.1 Detailed Description


Declares various string-to-integer type conversion templates.
These templates are the mechanism used within mysqlpp::ColData_Tmpl(p. 52) for its string-to-something conversions.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.7 datetime.h File Reference

191

8.7 datetime.h File Reference


Declares classes to add MySQL-compatible date and time types to C++'s type
system.

#include "common.h"
#include "coldata.h"
#include "stream2string.h"
#include "tiny_int.h"
#include <string>
#include <sstream>
#include <iostream>
Include dependency graph for datetime.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.7.1 Detailed Description


Declares classes to add MySQL-compatible date and time types to C++'s type
system.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

192

MySQL++ File Documentation

8.8 exceptions.h File Reference


Declares the MySQL++-specic exception classes.

#include "connection.h"
#include <exception>
#include <string>
Include dependency graph for exceptions.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.8.1 Detailed Description


Declares the MySQL++-specic exception classes.
exceptions are enabled for a given mysqlpp::OptionalExceptions(p. 119) derivative, any of these exceptions can be thrown on
When
error.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.9 eld_names.h File Reference

8.9 eld_names.h File Reference


Declares a class to hold a list of eld names.

#include "coldata.h"
#include "string_util.h"
#include <algorithm>
#include <vector>
Include dependency graph for eld_names.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.9.1 Detailed Description


Declares a class to hold a list of eld names.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

193

194

MySQL++ File Documentation

8.10 eld_types.h File Reference


Declares a class to hold a list of SQL eld type info.

#include "type_info.h"
#include <vector>
Include dependency graph for eld_types.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.10.1 Detailed Description


Declares a class to hold a list of SQL eld type info.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.11 elds.h File Reference

8.11 elds.h File Reference


Declares a class for holding information about a set of elds.

#include "resiter.h"
Include dependency graph for elds.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.11.1 Detailed Description


Declares a class for holding information about a set of elds.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

195

196

MySQL++ File Documentation

8.12 lockable.h File Reference


Declares interface that allows a class to declare itself as "lockable".
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.12.1 Detailed Description


Declares interface that allows a class to declare itself as "lockable".
The meaning of a class being lockable is very much per-class specic in this
version of MySQL++. In a future version, it will imply that operations that
aren't normally thread-safe will use platform mutexes if MySQL++ is congured
to support them. This is planned for a version beyond v2.0. (See the Wishlist
for the plan.) In the meantime, do not depend on this mechanism for thread
safety; you will have to serialize access to some resources yourself.
To eect this variability in what it means for an object to be "locked", Lockable
is only an interface. It delegates the actual implementation to a subclass of the
Lock interface, using the Bridge pattern. (See Gamma et al.)

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.13 manip.h File Reference

197

8.13 manip.h File Reference


Declares std::ostream manipulators useful with SQL syntax.

#include "common.h"
#include "datetime.h"
#include "myset.h"
#include "sql_string.h"
#include <iostream>
Include dependency graph for manip.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.13.1 Detailed Description


Declares std::ostream manipulators useful with SQL syntax.
These manipulators let you automatically quote elements or escape characters
that are special in SQL when inserting them into an std::ostream. Since
mysqlpp::Query(p. 121) is an ostream, these manipulators make it easier to
build syntactically-correct SQL queries.
This le also includes operator<< denitions for ColData_Tmpl, one of the
MySQL++ string-like classes. When inserting such items into a stream, they
are automatically quoted and escaped as necessary unless the global variable
dont_quote_auto is set to true. These operators are smart enough to turn
this behavior o when the stream is cout or cerr, however, since quoting and
escaping are surely not required in that instance.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

198

MySQL++ File Documentation

8.14 myset.h File Reference


Declares templates for generating custom containers used elsewhere in the library.

#include "common.h"
#include "coldata.h"
#include "stream2string.h"
#include <iostream>
#include <set>
#include <vector>
Include dependency graph for myset.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.14.1 Detailed Description


Declares templates for generating custom containers used elsewhere in the library.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.15 mysql++.h File Reference

199

8.15 mysql++.h File Reference


The main MySQL++ header le.

#include "connection.h"
#include "query.h"
#include "sql_types.h"
Include dependency graph for mysql++.h:

Namespaces
namespace mysqlpp

Denes
#dene MYSQLPP_VERSION(major, minor, bugx) (((major) <<
16) | ((minor) << 8) | (bugx))

Encode MySQL++ library version number.


#dene
MYSQLPP_HEADER_VERSION
VERSION(2, 3, 2)

MYSQLPP_-

Get the library version number that mysql++.h comes from.

8.15.1 Detailed Description


The main MySQL++ header le.
This le brings in all MySQL++ headers except for custom.h and custommacros.h which are a strictly optional feature of MySQL++.
There is no point in trying to optimize which headers you include, because the
MySQL++ headers are so intertwined. You can only get trivial compile time
benets, at the expense of clarity.

8.15.2 Dene Documentation


[Link]

#dene MYSQLPP_HEADER_VERSION
MYSQLPP_VERSION(2, 3, 2)

Get the library version number that mysql++.h comes from.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

200

MySQL++ File Documentation

MySQL++ Version number that the mysql++.h header le comes from, encoded
by MYSQLPP_VERSION macro. Compare this value to what mysqlpp_lib_version() returns in order to ensure that your program is using header les from
the same version of MySQL++ as the actual library you're linking to.

[Link]

#dene MYSQLPP_VERSION(major, minor, bugx)


(((major) << 16) | ((minor) << 8) | (bugx))

Encode MySQL++ library version number.


This macro takes major, minor and bugx numbers (e.g. 1, 2, and 3) and
encodes them like 0x010203.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.16 noexceptions.h File Reference

201

8.16 noexceptions.h File Reference


Declares interface that allows exceptions to be optional.
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.16.1 Detailed Description


Declares interface that allows exceptions to be optional.
A class may inherit from OptionalExceptions, which will add to it a mechanism
by which a user can tell objects of that class to suppress exceptions. (They are
enabled by default.) This module also declares a NoExceptions class, objects
of which take a reference to any class derived from OptionalExceptions. The
NoExceptions constructor calls the method that disables exceptions, and the
destructor reverts them to the previous state. One uses the NoExceptions object
within a scope to suppress exceptions in that block, without having to worry
about reverting the setting when the block exits.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

202

MySQL++ File Documentation

8.17 null.h File Reference


Declares classes that implement SQL "null" semantics within C++'s type system.

#include "exceptions.h"
#include <iostream>
Include dependency graph for null.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.17.1 Detailed Description


Declares classes that implement SQL "null" semantics within C++'s type system.
This is required because C++'s own NULL type is not semantically the same
as SQL nulls.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.18 qparms.h File Reference

203

8.18 qparms.h File Reference


Declares the template query parameter-related stu.

#include "sql_string.h"
#include <vector>
Include dependency graph for qparms.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.18.1 Detailed Description


Declares the template query parameter-related stu.
The classes dened in this le are used by class Query when it parses a template
query: they hold information that it nds in the template, so it can assemble a
SQL statement later on demand.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

204

MySQL++ File Documentation

8.19 query.h File Reference


Denes a class for building and executing SQL queries.

#include "common.h"
#include "lockable.h"
#include "noexceptions.h"
#include "qparms.h"
#include "querydef.h"
#include "result.h"
#include "row.h"
#include "sql_string.h"
#include <deque>
#include <iomanip>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <vector>
Include dependency graph for query.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

Denes
#dene MYSQLPP_QUERY_THISPTR this

Helper macro used inside MySQL++ to work around a VC++ 2003 bug.

8.19.1 Detailed Description


Denes a class for building and executing SQL queries.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.19 query.h File Reference

205

8.19.2 Dene Documentation


[Link]

#dene MYSQLPP_QUERY_THISPTR this

Helper macro used inside MySQL++ to work around a VC++ 2003 bug.
This macro returns 'this', either directly or upcast to Query's base
class to work around an error in the overloaded operator lookup
logic in VC++ 2003.
For an explanation of the problem, see:
[Link]

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

206

MySQL++ File Documentation

8.20 resiter.h File Reference


Declares templates for adapting existing classes to be iteratable random-access
containers.

#include "common.h"
#include <iterator>
Include dependency graph for resiter.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.20.1 Detailed Description


Declares templates for adapting existing classes to be iteratable random-access
containers.
The le name seems to tie it to the mysqlpp::Result(p. 140) class, which is so
adapted, but these templates are also used to adapt the mysqlpp::Fields(p. 96)
and mysqlpp::Row(p. 148) classes.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.21 result.h File Reference

8.21 result.h File Reference


Declares classes for holding SQL query result sets.

#include "common.h"
#include "exceptions.h"
#include "fields.h"
#include "field_names.h"
#include "field_types.h"
#include "noexceptions.h"
#include "resiter.h"
#include "row.h"
#include <map>
#include <set>
#include <string>
Include dependency graph for result.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.21.1 Detailed Description


Declares classes for holding SQL query result sets.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

207

208

MySQL++ File Documentation

8.22 row.h File Reference


Declares the classes for holding row data from a result set.

#include "coldata.h"
#include "exceptions.h"
#include "noexceptions.h"
#include "resiter.h"
#include "vallist.h"
#include <vector>
#include <string>
#include <string.h>
Include dependency graph for row.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.22.1 Detailed Description


Declares the classes for holding row data from a result set.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.23 sql_string.h File Reference

209

8.23 sql_string.h File Reference


Declares an std::string derivative that adds some things needed within the
library.

#include "common.h"
#include "null.h"
#include <stdio.h>
#include <string>
Include dependency graph for sql_string.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.23.1 Detailed Description


Declares an std::string derivative that adds some things needed within the
library.
This class adds some ags needed by other parts of MySQL++, and it adds
conversion functions from any primitive type. This helps in inserting these
primitive types into the database, because we need everything in string form to
build SQL queries.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

210

MySQL++ File Documentation

8.24 sql_types.h File Reference


Declares the closest C++ equivalent of each MySQL column type.

#include "common.h"
#include <string>
Include dependency graph for sql_types.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.24.1 Detailed Description


Declares the closest C++ equivalent of each MySQL column type.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.25 stream2string.h File Reference

211

8.25 stream2string.h File Reference


Declares an adapter that converts something that can be inserted into a C++
stream into a string type.

#include <sstream>
Include dependency graph for stream2string.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.25.1 Detailed Description


Declares an adapter that converts something that can be inserted into a C++
stream into a string type.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

212

MySQL++ File Documentation

8.26 string_util.h File Reference


Declares string-handling utility functions used within the library.

#include "common.h"
#include <ctype.h>
#include <string>
Include dependency graph for string_util.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.26.1 Detailed Description


Declares string-handling utility functions used within the library.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.27 tiny_int.h File Reference

8.27 tiny_int.h File Reference


Declares class for holding a SQL tiny_int.
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.27.1 Detailed Description


Declares class for holding a SQL tiny_int.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

213

214

MySQL++ File Documentation

8.28 transaction.h File Reference


Declares the Transaction class.

#include "common.h"
Include dependency graph for transaction.h:

Namespaces
namespace mysqlpp

8.28.1 Detailed Description


Declares the Transaction class.
This object works with the Connection class to automate the use of MySQL
transactions. It allows you to express these transactions directly in C++ code
instead of sending the raw SQL commands.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

8.29 type_info.h File Reference

215

8.29 type_info.h File Reference


Declares classes that provide an interface between the SQL and C++ type
systems.

#include "common.h"
#include <map>
#include <typeinfo>
Include dependency graph for type_info.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.29.1 Detailed Description


Declares classes that provide an interface between the SQL and C++ type
systems.
These classes are mostly used internal to the library.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

216

MySQL++ File Documentation

8.30 vallist.h File Reference


Declares templates for holding lists of values.

#include "manip.h"
#include <string>
#include <vector>
Include dependency graph for vallist.h:
This graph shows which les directly or indirectly include this le:

Namespaces
namespace mysqlpp

8.30.1 Detailed Description


Declares templates for holding lists of values.

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

Index

BadConversion
mysqlpp::BadConversion, 44
BadFieldName
mysqlpp::BadFieldName, 45
base_type
mysqlpp::mysql_type_info,
106
before
mysqlpp::mysql_type_info,
106
bound
mysqlpp::SQLQueryParms,
165

ColData_Tmpl
mysqlpp::ColData_Tmpl, 55,
56
commit
mysqlpp::Transaction, 180
common.h, 187
compare
mysqlpp::const_string, 74
mysqlpp::Date, 80
mysqlpp::DateTime, 83
mysqlpp::DTbase, 86
mysqlpp::Time, 174
connect
mysqlpp::Connection, 64, 65
connected
mysqlpp::Connection, 65
Connection
mysqlpp::Connection, 63
connection.h, 188
const_string.h, 189
convert.h, 190
copy
mysqlpp::Connection, 65
mysqlpp::ResUse, 146
create_db
mysqlpp::Connection, 65
create_vector
mysqlpp, 27

c_type
mysqlpp::mysql_type_info,
106
client_info
mysqlpp::Connection, 64
close
mysqlpp::Connection, 64
coldata.h, 186

Date
mysqlpp::Date, 79
DateTime
mysqlpp::DateTime, 82
datetime.h, 191
def
mysqlpp::Query, 138
disconnect

NoExceptions
mysqlpp::NoExceptions, 109
Transaction
mysqlpp::Transaction, 179
aected_rows
mysqlpp::Connection, 64
api_version
mysqlpp::Connection, 64
at
mysqlpp::const_string, 74
mysqlpp::Row, 151
AutoFlag, 41
autoag.h, 185

218

INDEX

mysqlpp::Connection, 65
do_nothing
mysqlpp, 26
do_nothing_type0
mysqlpp, 25
dont_quote_auto
mysqlpp, 39
drop_db
mysqlpp::Connection, 66
enable_ssl
mysqlpp::Connection, 66
equal_list
mysqlpp, 28, 29
mysqlpp::Row, 152
equal_list_b
mysqlpp::equal_list_b, 90
equal_list_ba
mysqlpp::equal_list_ba, 92
errnum
mysqlpp::Connection, 66
error
mysqlpp::Connection, 66
mysqlpp::Query, 126
escape_q
mysqlpp::mysql_type_info,
106
escape_type0
mysqlpp, 26
exceptions.h, 192
exec
mysqlpp::Query, 126
execute
mysqlpp::Query, 127
fetch_row
mysqlpp::Result, 141
mysqlpp::ResUse, 146
eld_list
mysqlpp::Row, 152155
eld_name
mysqlpp::ResUse, 146
eld_names.h, 193
eld_num
mysqlpp::ResUse, 146
eld_types.h, 194

elds.h, 195
for_each
mysqlpp::Query, 128
get_library_version
mysqlpp, 30
get_string
mysqlpp::ColData_Tmpl, 56
host_info
mysqlpp::Connection, 66
id

mysqlpp::mysql_type_info,
106
ignore
mysqlpp, 26
ignore_type0
mysqlpp, 26
insert
mysqlpp::Query, 129
insert_id
mysqlpp::Connection, 67
is_null
mysqlpp::Null, 113
kill

mysqlpp::Connection, 67

length
mysqlpp::mysql_type_info,
106
lock
mysqlpp::BasicLock, 50
mysqlpp::Lock, 99
mysqlpp::Lockable, 100
lockable.h, 196
manip.h, 197
max_length
mysqlpp::mysql_type_info,
107
max_size
mysqlpp::const_string, 74
more_results
mysqlpp::Query, 130
myset.h, 198

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

INDEX
mysql++.h, 199
MYSQLPP_HEADER_VERSION, 199
MYSQLPP_VERSION, 200
mysql_type_info
mysqlpp::mysql_type_info,
105
mysqlpp, 13
create_vector, 27
do_nothing, 26
do_nothing_type0, 25
dont_quote_auto, 39
equal_list, 28, 29
escape_type0, 26
get_library_version, 30
ignore, 26
ignore_type0, 26
operator<<, 3036
quote, 27
quote_double_only, 26
quote_double_only_type0, 26
quote_only, 27
quote_only_type0, 26
quote_type0, 27
stream2string, 36
value_list, 37, 38
mysqlpp::BadConversion, 43
mysqlpp::BadConversion
BadConversion, 44
mysqlpp::BadFieldName, 45
mysqlpp::BadFieldName
BadFieldName, 45
mysqlpp::BadNullConversion, 46
mysqlpp::BadOption, 47
mysqlpp::BadParamCount, 48
mysqlpp::BadQuery, 49
mysqlpp::BasicLock, 50
mysqlpp::BasicLock
lock, 50
mysqlpp::ColData_Tmpl, 52
mysqlpp::ColData_Tmpl
ColData_Tmpl, 55, 56
get_string, 56
operator Null, 57
mysqlpp::Connection, 58
aected_rows, 64

219
api_version, 64
client_info, 64
close, 64
connect, 64, 65
connected, 65
Connection, 63
copy, 65
create_db, 65
disconnect, 65
drop_db, 66
enable_ssl, 66
errnum, 66
error, 66
host_info, 66
insert_id, 67
kill, 67
operator bool, 67
Option, 62
ping, 67
proto_info, 68
query, 68
refresh, 68
reload, 68
server_info, 68
set_option, 69
set_option_impl, 69
shutdown, 70
stat, 70
mysqlpp::ConnectionFailed, 71
mysqlpp::const_string, 72
at, 74
compare, 74
max_size, 74
mysqlpp::const_subscript_container, 75
mysqlpp::Date, 78
compare, 80
Date, 79
year, 80
mysqlpp::DateTime, 81
mysqlpp::DateTime
compare, 83
DateTime, 82
year, 83
mysqlpp::DBSelectionFailed, 84
mysqlpp::DTbase, 85

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

220

INDEX

compare, 86
mysqlpp::EndOfResults, 87
mysqlpp::EndOfResultSets, 88
mysqlpp::equal_list_b, 89
equal_list_b, 90
mysqlpp::equal_list_ba, 91
equal_list_ba, 92
mysqlpp::Exception, 93
mysqlpp::FieldNames, 95
mysqlpp::Fields, 96
mysqlpp::FieldTypes, 97
mysqlpp::FieldTypes
operator=, 97
mysqlpp::Lock, 99
lock, 99
mysqlpp::Lockable, 100
lock, 100
mysqlpp::LockFailed, 102
mysqlpp::mysql_type_info, 103
base_type, 106
before, 106
c_type, 106
escape_q, 106
id, 106
length, 106
max_length, 107
mysql_type_info, 105
name, 107
operator=, 107
quote_q, 107
sql_name, 107
string_type, 108
mysqlpp::NoExceptions, 109
mysqlpp::NoExceptions
NoExceptions, 109
NoExceptions, 109
mysqlpp::Null, 110
is_null, 113
Null, 111
operator Type &, 112
operator=, 112
mysqlpp::null_type, 114
mysqlpp::NullisBlank, 115
mysqlpp::NullisNull, 116
mysqlpp::NullisZero, 117
mysqlpp::ObjectNotInitialized, 118

mysqlpp::OptionalExceptions, 119
mysqlpp::OptionalExceptions
OptionalExceptions, 120
set_exceptions, 120
mysqlpp::Query, 121
def, 138
error, 126
exec, 126
execute, 127
for_each, 128
insert, 129
more_results, 130
operator=, 130
parse, 130
preview, 130
Query, 126
replace, 130
reset, 131
store, 131
store_if, 132, 133
store_next, 133
storein, 134
storein_sequence, 134
storein_set, 135
str, 135, 136
success, 136
update, 136
use, 136, 137
mysqlpp::ResNSel, 139
mysqlpp::Result, 140
fetch_row, 141
mysqlpp::ResUse, 142
mysqlpp::ResUse
copy, 146
fetch_row, 146
eld_name, 146
eld_num, 146
operator bool, 146
operator==, 147
purge, 147
table, 147
mysqlpp::Row, 148
at, 151
equal_list, 152
eld_list, 152155
operator[], 155

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

INDEX
raw_data, 156
raw_string, 156
Row, 151
value_list, 156159
mysqlpp::scoped_var_set, 160
mysqlpp::Set, 161
mysqlpp::SQLParseElement, 162
mysqlpp::SQLParseElement
SQLParseElement, 163
mysqlpp::SQLQueryParms, 164
mysqlpp::SQLQueryParms
bound, 165
operator+, 165
set, 166
SQLQueryParms, 165
mysqlpp::SQLString, 167
processed, 168
mysqlpp::subscript_iterator, 170
mysqlpp::Time, 173
compare, 174
Time, 174
mysqlpp::tiny_int, 176
tiny_int, 178
mysqlpp::Transaction, 179
Transaction, 179
commit, 180
rollback, 180
Transaction, 179
mysqlpp::value_list_b, 181
value_list_b, 182
mysqlpp::value_list_ba, 183
value_list_ba, 184
MYSQLPP_HEADER_VERSION
mysql++.h, 199
MYSQLPP_QUERY_THISPTR
query.h, 205
MYSQLPP_VERSION
mysql++.h, 200
name
mysqlpp::mysql_type_info,
107
NoExceptions
mysqlpp::NoExceptions, 109
noexceptions.h, 201

221
Null

mysqlpp::Null, 111
null.h, 202
operator bool
mysqlpp::Connection, 67
mysqlpp::ResUse, 146
operator Null
mysqlpp::ColData_Tmpl, 57
operator Type &
mysqlpp::Null, 112
operator+
mysqlpp::SQLQueryParms,
165
operator<<
mysqlpp, 3036
operator=
mysqlpp::FieldTypes, 97
mysqlpp::mysql_type_info,
107
mysqlpp::Null, 112
mysqlpp::Query, 130
operator==
mysqlpp::ResUse, 147
operator[]
mysqlpp::Row, 155
Option
mysqlpp::Connection, 62
OptionalExceptions
mysqlpp::OptionalExceptions,
120
parse
mysqlpp::Query, 130
ping
mysqlpp::Connection, 67
preview
mysqlpp::Query, 130
processed
mysqlpp::SQLString, 168
proto_info
mysqlpp::Connection, 68
purge
mysqlpp::ResUse, 147
qparms.h, 203

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

222

INDEX

Query
mysqlpp::Query, 126
query
mysqlpp::Connection, 68
query.h, 204
MYSQLPP_QUERY_THISPTR, 205
quote
mysqlpp, 27
quote_double_only
mysqlpp, 26
quote_double_only_type0
mysqlpp, 26
quote_only
mysqlpp, 27
quote_only_type0
mysqlpp, 26
quote_q
mysqlpp::mysql_type_info,
107
quote_type0
mysqlpp, 27
raw_data
mysqlpp::Row, 156
raw_string
mysqlpp::Row, 156
refresh
mysqlpp::Connection, 68
reload
mysqlpp::Connection, 68
replace
mysqlpp::Query, 130
reset
mysqlpp::Query, 131
resiter.h, 206
result.h, 207
rollback
mysqlpp::Transaction, 180
Row
mysqlpp::Row, 151
row.h, 208
server_info
mysqlpp::Connection, 68
set

mysqlpp::SQLQueryParms,
166
set_exceptions
mysqlpp::OptionalExceptions,
120
set_option
mysqlpp::Connection, 69
set_option_impl
mysqlpp::Connection, 69
shutdown
mysqlpp::Connection, 70
sql_name
mysqlpp::mysql_type_info,
107
sql_string.h, 209
sql_types.h, 210
SQLParseElement
mysqlpp::SQLParseElement,
163
SQLQueryParms
mysqlpp::SQLQueryParms,
165
stat
mysqlpp::Connection, 70
store
mysqlpp::Query, 131
store_if
mysqlpp::Query, 132, 133
store_next
mysqlpp::Query, 133
storein
mysqlpp::Query, 134
storein_sequence
mysqlpp::Query, 134
storein_set
mysqlpp::Query, 135
str
mysqlpp::Query, 135, 136
stream2string
mysqlpp, 36
stream2string.h, 211
string_type
mysqlpp::mysql_type_info,
108
string_util.h, 212
success

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

INDEX
mysqlpp::Query, 136
table
mysqlpp::ResUse, 147
Time
mysqlpp::Time, 174
tiny_int
mysqlpp::tiny_int, 178
tiny_int.h, 213
Transaction
mysqlpp::Transaction, 179
transaction.h, 214
type_info.h, 215
update
mysqlpp::Query, 136
use
mysqlpp::Query, 136, 137
vallist.h, 216
value_list
mysqlpp, 37, 38
mysqlpp::Row, 156159
value_list_b
mysqlpp::value_list_b, 182
value_list_ba
mysqlpp::value_list_ba, 184
year

mysqlpp::Date, 80
mysqlpp::DateTime, 83

Generated on Wed Jul 11 [Link] 2007 for MySQL++ by Doxygen

223

También podría gustarte