- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# options.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004
    00005
    00006
    00007
    00008
    00009
    00010
    00011 /***********************************************************************
    00012  Copyright (c) 2007-2009 by Educational Technology Resources, Inc.
    00013  Others may also hold copyrights on code in this file.  See the
    00014  CREDITS file in the top directory of the distribution for details.
    00015
    00016  This file is part of MySQL++.
    00017
    00018  MySQL++ is free software; you can redistribute it and/or modify it
    00019  under the terms of the GNU Lesser General Public License as published
    00020  by the Free Software Foundation; either version 2.1 of the License, or
    00021  (at your option) any later version.
    00022
    00023  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
    00024  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00025  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
    00026  License for more details.
    00027
    00028  You should have received a copy of the GNU Lesser General Public
    00029  License along with MySQL++; if not, write to the Free Software
    00030  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00031  USA
    00032 ***********************************************************************/
    00033
    00034 #if !defined(MYSQLPP_OPTIONS_H)
    00035 #define MYSQLPP_OPTIONS_H
    00036
    00037 #include "common.h"
    00038
    00039 #include <deque>
    00040 #include <string>
    00041
    00042
    00043 namespace mysqlpp {
    00044
    00045 #if !defined(DOXYGEN_IGNORE)
    00046 class DBDriver;
    00047 #endif
    00048
    00049
    00051 // Classes
    00052
    00057 class MYSQLPP_EXPORT Option
    00058 {
    00059 public:
    00061         enum Error {
    00062                 err_NONE,
    00063                 err_api_limit,
    00064                 err_api_reject,
    00065                 err_connected,
    00066                 err_disconnected
    00067         };
    00068
    00069         virtual ~Option() { }
    00070         virtual Error set(DBDriver* dbd) = 0;
    00071 };
    00072
    00073
    00076 template <typename T>
    00077 class MYSQLPP_EXPORT DataOption : public Option
    00078 {
    00079 public:
    00080         typedef T ArgType;
    00081
    00082 protected:
    00083         DataOption(const T& arg) : arg_(arg) { }
    00084         T arg_;
    00085 };
    00086
    00087 typedef DataOption<unsigned> IntegerOption;
    00088 typedef DataOption<bool> BooleanOption;
    00089 typedef DataOption<std::string> StringOption;
    00090
    00091
    00093 class MYSQLPP_EXPORT CompressOption : public Option
    00094 {
    00095 #if !defined(DOXYGEN_IGNORE)
    00096 public:
    00097         CompressOption() : Option() { }
    00098
    00099 private:
    00100         Error set(DBDriver* dbd);
    00101 #endif
    00102 };
    00103
    00104
    00106 class MYSQLPP_EXPORT ConnectTimeoutOption : public IntegerOption
    00107 {
    00108 #if !defined(DOXYGEN_IGNORE)
    00109 public:
    00110         ConnectTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00111
    00112 private:
    00113         Error set(DBDriver* dbd);
    00114 #endif
    00115 };
    00116
    00117
    00121 class MYSQLPP_EXPORT FoundRowsOption : public BooleanOption
    00122 {
    00123 #if !defined(DOXYGEN_IGNORE)
    00124 public:
    00125         FoundRowsOption(ArgType arg) : BooleanOption(arg) { }
    00126
    00127 private:
    00128         Error set(DBDriver* dbd);
    00129 #endif
    00130 };
    00131
    00132
    00137 class MYSQLPP_EXPORT GuessConnectionOption : public Option
    00138 {
    00139 #if !defined(DOXYGEN_IGNORE)
    00140 public:
    00141         GuessConnectionOption() : Option() { }
    00142
    00143 private:
    00144         Error set(DBDriver* dbd);
    00145 #endif
    00146 };
    00147
    00148
    00150 class MYSQLPP_EXPORT IgnoreSpaceOption : public BooleanOption
    00151 {
    00152 #if !defined(DOXYGEN_IGNORE)
    00153 public:
    00154         IgnoreSpaceOption(ArgType arg) : BooleanOption(arg) { }
    00155
    00156 private:
    00157         Error set(DBDriver* dbd);
    00158 #endif
    00159 };
    00160
    00161
    00163 class MYSQLPP_EXPORT InitCommandOption : public StringOption
    00164 {
    00165 #if !defined(DOXYGEN_IGNORE)
    00166 public:
    00167         InitCommandOption(ArgType arg) : StringOption(arg) { }
    00168
    00169 private:
    00170         Error set(DBDriver* dbd);
    00171 #endif
    00172 };
    00173
    00174
    00178 class MYSQLPP_EXPORT InteractiveOption : public BooleanOption
    00179 {
    00180 #if !defined(DOXYGEN_IGNORE)
    00181 public:
    00182         InteractiveOption(ArgType arg) : BooleanOption(arg) { }
    00183
    00184 private:
    00185         Error set(DBDriver* dbd);
    00186 #endif
    00187 };
    00188
    00189
    00191 class MYSQLPP_EXPORT LocalFilesOption : public BooleanOption
    00192 {
    00193 #if !defined(DOXYGEN_IGNORE)
    00194 public:
    00195         LocalFilesOption(ArgType arg) : BooleanOption(arg) { }
    00196
    00197 private:
    00198         Error set(DBDriver* dbd);
    00199 #endif
    00200 };
    00201
    00202
    00204 class MYSQLPP_EXPORT LocalInfileOption : public IntegerOption
    00205 {
    00206 #if !defined(DOXYGEN_IGNORE)
    00207 public:
    00208         LocalInfileOption(ArgType arg) : IntegerOption(arg) { }
    00209
    00210 private:
    00211         Error set(DBDriver* dbd);
    00212 #endif
    00213 };
    00214
    00215
    00217 class MYSQLPP_EXPORT MultiResultsOption : public BooleanOption
    00218 {
    00219 #if !defined(DOXYGEN_IGNORE)
    00220 public:
    00221         MultiResultsOption(ArgType arg) : BooleanOption(arg) { }
    00222
    00223 private:
    00224         Error set(DBDriver* dbd);
    00225 #endif
    00226 };
    00227
    00228
    00230 class MYSQLPP_EXPORT MultiStatementsOption : public BooleanOption
    00231 {
    00232 #if !defined(DOXYGEN_IGNORE)
    00233 public:
    00234         MultiStatementsOption(ArgType arg) : BooleanOption(arg) { }
    00235
    00236 private:
    00237         Error set(DBDriver* dbd);
    00238 #endif
    00239 };
    00240
    00241
    00243 class MYSQLPP_EXPORT NamedPipeOption : public Option
    00244 {
    00245 #if !defined(DOXYGEN_IGNORE)
    00246 public:
    00247         NamedPipeOption() : Option() { }
    00248
    00249 private:
    00250         Error set(DBDriver* dbd);
    00251 #endif
    00252 };
    00253
    00254
    00256 class MYSQLPP_EXPORT NoSchemaOption : public BooleanOption
    00257 {
    00258 #if !defined(DOXYGEN_IGNORE)
    00259 public:
    00260         NoSchemaOption(ArgType arg) : BooleanOption(arg) { }
    00261
    00262 private:
    00263         Error set(DBDriver* dbd);
    00264 #endif
    00265 };
    00266
    00267
    00268 #if MYSQL_VERSION_ID > 40000            // only in 4.0 +
    00270 class MYSQLPP_EXPORT ProtocolOption : public IntegerOption
    00271 {
    00272 #if !defined(DOXYGEN_IGNORE)
    00273 public:
    00274         ProtocolOption(ArgType arg) : IntegerOption(arg) { }
    00275
    00276 private:
    00277         Error set(DBDriver* dbd);
    00278 #endif
    00279 };
    00280 #endif
    00281
    00282
    00284 class MYSQLPP_EXPORT ReadDefaultFileOption : public StringOption
    00285 {
    00286 #if !defined(DOXYGEN_IGNORE)
    00287 public:
    00288         ReadDefaultFileOption(ArgType arg) : StringOption(arg) { }
    00289
    00290 private:
    00291         Error set(DBDriver* dbd);
    00292 #endif
    00293 };
    00294
    00295
    00297 class MYSQLPP_EXPORT ReadDefaultGroupOption : public StringOption
    00298 {
    00299 #if !defined(DOXYGEN_IGNORE)
    00300 public:
    00301         ReadDefaultGroupOption(ArgType arg) : StringOption(arg) { }
    00302
    00303 private:
    00304         Error set(DBDriver* dbd);
    00305 #endif
    00306 };
    00307
    00308
    00310 class MYSQLPP_EXPORT ReadTimeoutOption : public IntegerOption
    00311 {
    00312 #if !defined(DOXYGEN_IGNORE)
    00313 public:
    00314         ReadTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00315
    00316 private:
    00317         Error set(DBDriver* dbd);
    00318 #endif
    00319 };
    00320
    00321
    00323 class MYSQLPP_EXPORT ReconnectOption : public BooleanOption
    00324 {
    00325 #if !defined(DOXYGEN_IGNORE)
    00326 public:
    00327         ReconnectOption(ArgType arg) : BooleanOption(arg) { }
    00328
    00329 private:
    00330         Error set(DBDriver* dbd);
    00331 #endif
    00332 };
    00333
    00334
    00336 class MYSQLPP_EXPORT ReportDataTruncationOption : public BooleanOption
    00337 {
    00338 #if !defined(DOXYGEN_IGNORE)
    00339 public:
    00340         ReportDataTruncationOption(ArgType arg) : BooleanOption(arg) { }
    00341
    00342 private:
    00343         Error set(DBDriver* dbd);
    00344 #endif
    00345 };
    00346
    00347
    00350 class MYSQLPP_EXPORT SecureAuthOption : public BooleanOption
    00351 {
    00352 #if !defined(DOXYGEN_IGNORE)
    00353 public:
    00354         SecureAuthOption(ArgType arg) : BooleanOption(arg) { }
    00355
    00356 private:
    00357         Error set(DBDriver* dbd);
    00358 #endif
    00359 };
    00360
    00361
    00363 class MYSQLPP_EXPORT SetCharsetDirOption : public StringOption
    00364 {
    00365 #if !defined(DOXYGEN_IGNORE)
    00366 public:
    00367         SetCharsetDirOption(ArgType arg) : StringOption(arg) { }
    00368
    00369 private:
    00370         Error set(DBDriver* dbd);
    00371 #endif
    00372 };
    00373
    00374
    00376 class MYSQLPP_EXPORT SetCharsetNameOption : public StringOption
    00377 {
    00378 #if !defined(DOXYGEN_IGNORE)
    00379 public:
    00380         SetCharsetNameOption(ArgType arg) : StringOption(arg) { }
    00381
    00382 private:
    00383         Error set(DBDriver* dbd);
    00384 #endif
    00385 };
    00386
    00387
    00389 class MYSQLPP_EXPORT SetClientIpOption : public StringOption
    00390 {
    00391 #if !defined(DOXYGEN_IGNORE)
    00392 public:
    00393         SetClientIpOption(ArgType arg) : StringOption(arg) { }
    00394
    00395 private:
    00396         Error set(DBDriver* dbd);
    00397 #endif
    00398 };
    00399
    00400
    00402 class MYSQLPP_EXPORT SharedMemoryBaseNameOption : public StringOption
    00403 {
    00404 #if !defined(DOXYGEN_IGNORE)
    00405 public:
    00406         SharedMemoryBaseNameOption(ArgType arg) : StringOption(arg) { }
    00407
    00408 private:
    00409         Error set(DBDriver* dbd);
    00410 #endif
    00411 };
    00412
    00413
    00415 class MYSQLPP_EXPORT SslOption : public Option
    00416 {
    00417 public:
    00430         SslOption(const char* key = 0, const char* cert = 0,
    00431                         const char* ca = 0, const char* capath = 0,
    00432                         const char* cipher = 0)
    00433         {
    00434                 if (key)        key_.assign(key);
    00435                 if (cert)       cert_.assign(cert);
    00436                 if (ca)         ca_.assign(ca);
    00437                 if (capath)     capath_.assign(capath);
    00438                 if (cipher)     cipher_.assign(cipher);
    00439         }
    00440
    00441 private:
    00442         std::string key_, cert_, ca_, capath_, cipher_;
    00443         Error set(DBDriver* dbd);
    00444 };
    00445
    00446
    00448 class MYSQLPP_EXPORT UseEmbeddedConnectionOption : public Option
    00449 {
    00450 #if !defined(DOXYGEN_IGNORE)
    00451 public:
    00452         UseEmbeddedConnectionOption() : Option() { }
    00453
    00454 private:
    00455         Error set(DBDriver* dbd);
    00456 #endif
    00457 };
    00458
    00459
    00461 class MYSQLPP_EXPORT UseRemoteConnectionOption : public Option
    00462 {
    00463 #if !defined(DOXYGEN_IGNORE)
    00464 public:
    00465         UseRemoteConnectionOption() : Option() { }
    00466
    00467 private:
    00468         Error set(DBDriver* dbd);
    00469 #endif
    00470 };
    00471
    00472
    00474 class MYSQLPP_EXPORT WriteTimeoutOption : public IntegerOption
    00475 {
    00476 #if !defined(DOXYGEN_IGNORE)
    00477 public:
    00478         WriteTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00479
    00480 private:
    00481         Error set(DBDriver* dbd);
    00482 #endif
    00483 };
    00484
    00485
    00487 // Typedefs
    00488
    00490 typedef std::deque<Option*> OptionList;
    00491
    00493 typedef OptionList::const_iterator OptionListIt;
    00494
    00495 } // end namespace mysqlpp
    00496
    00497 #endif // !defined(MYSQLPP_OPTIONS_H)