- Main Page
- 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 by Educational Technology Resources, Inc.  Others
    00013  may also hold copyrights on code in this file.  See the CREDITS
    00014  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         };
    00067
    00068         virtual ~Option() { }
    00069         virtual Error set(DBDriver* dbd) = 0;
    00070 };
    00071
    00072
    00075 template <typename T>
    00076 class MYSQLPP_EXPORT DataOption : public Option
    00077 {
    00078 public:
    00079         typedef T ArgType;
    00080
    00081 protected:
    00082         DataOption(const T& arg) : arg_(arg) { }
    00083         T arg_;
    00084 };
    00085
    00086 typedef DataOption<unsigned> IntegerOption;
    00087 typedef DataOption<bool> BooleanOption;
    00088 typedef DataOption<std::string> StringOption;
    00089
    00090
    00092 class MYSQLPP_EXPORT CompressOption : public Option
    00093 {
    00094 #if !defined(DOXYGEN_IGNORE)
    00095 public:
    00096         CompressOption() : Option() { }
    00097
    00098 private:
    00099         Error set(DBDriver* dbd);
    00100 #endif
    00101 };
    00102
    00103
    00105 class MYSQLPP_EXPORT ConnectTimeoutOption : public IntegerOption
    00106 {
    00107 #if !defined(DOXYGEN_IGNORE)
    00108 public:
    00109         ConnectTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00110
    00111 private:
    00112         Error set(DBDriver* dbd);
    00113 #endif
    00114 };
    00115
    00116
    00120 class MYSQLPP_EXPORT FoundRowsOption : public BooleanOption
    00121 {
    00122 #if !defined(DOXYGEN_IGNORE)
    00123 public:
    00124         FoundRowsOption(ArgType arg) : BooleanOption(arg) { }
    00125
    00126 private:
    00127         Error set(DBDriver* dbd);
    00128 #endif
    00129 };
    00130
    00131
    00136 class MYSQLPP_EXPORT GuessConnectionOption : public Option
    00137 {
    00138 #if !defined(DOXYGEN_IGNORE)
    00139 public:
    00140         GuessConnectionOption() : Option() { }
    00141
    00142 private:
    00143         Error set(DBDriver* dbd);
    00144 #endif
    00145 };
    00146
    00147
    00149 class MYSQLPP_EXPORT IgnoreSpaceOption : public BooleanOption
    00150 {
    00151 #if !defined(DOXYGEN_IGNORE)
    00152 public:
    00153         IgnoreSpaceOption(ArgType arg) : BooleanOption(arg) { }
    00154
    00155 private:
    00156         Error set(DBDriver* dbd);
    00157 #endif
    00158 };
    00159
    00160
    00162 class MYSQLPP_EXPORT InitCommandOption : public StringOption
    00163 {
    00164 #if !defined(DOXYGEN_IGNORE)
    00165 public:
    00166         InitCommandOption(ArgType arg) : StringOption(arg) { }
    00167
    00168 private:
    00169         Error set(DBDriver* dbd);
    00170 #endif
    00171 };
    00172
    00173
    00177 class MYSQLPP_EXPORT InteractiveOption : public BooleanOption
    00178 {
    00179 #if !defined(DOXYGEN_IGNORE)
    00180 public:
    00181         InteractiveOption(ArgType arg) : BooleanOption(arg) { }
    00182
    00183 private:
    00184         Error set(DBDriver* dbd);
    00185 #endif
    00186 };
    00187
    00188
    00190 class MYSQLPP_EXPORT LocalFilesOption : public BooleanOption
    00191 {
    00192 #if !defined(DOXYGEN_IGNORE)
    00193 public:
    00194         LocalFilesOption(ArgType arg) : BooleanOption(arg) { }
    00195
    00196 private:
    00197         Error set(DBDriver* dbd);
    00198 #endif
    00199 };
    00200
    00201
    00203 class MYSQLPP_EXPORT LocalInfileOption : public IntegerOption
    00204 {
    00205 #if !defined(DOXYGEN_IGNORE)
    00206 public:
    00207         LocalInfileOption(ArgType arg) : IntegerOption(arg) { }
    00208
    00209 private:
    00210         Error set(DBDriver* dbd);
    00211 #endif
    00212 };
    00213
    00214
    00216 class MYSQLPP_EXPORT MultiResultsOption : public BooleanOption
    00217 {
    00218 #if !defined(DOXYGEN_IGNORE)
    00219 public:
    00220         MultiResultsOption(ArgType arg) : BooleanOption(arg) { }
    00221
    00222 private:
    00223         Error set(DBDriver* dbd);
    00224 #endif
    00225 };
    00226
    00227
    00229 class MYSQLPP_EXPORT MultiStatementsOption : public BooleanOption
    00230 {
    00231 #if !defined(DOXYGEN_IGNORE)
    00232 public:
    00233         MultiStatementsOption(ArgType arg) : BooleanOption(arg) { }
    00234
    00235 private:
    00236         Error set(DBDriver* dbd);
    00237 #endif
    00238 };
    00239
    00240
    00242 class MYSQLPP_EXPORT NamedPipeOption : public Option
    00243 {
    00244 #if !defined(DOXYGEN_IGNORE)
    00245 public:
    00246         NamedPipeOption() : Option() { }
    00247
    00248 private:
    00249         Error set(DBDriver* dbd);
    00250 #endif
    00251 };
    00252
    00253
    00255 class MYSQLPP_EXPORT NoSchemaOption : public BooleanOption
    00256 {
    00257 #if !defined(DOXYGEN_IGNORE)
    00258 public:
    00259         NoSchemaOption(ArgType arg) : BooleanOption(arg) { }
    00260
    00261 private:
    00262         Error set(DBDriver* dbd);
    00263 #endif
    00264 };
    00265
    00266
    00267 #if MYSQL_VERSION_ID > 40000            // only in 4.0 +
    00269 class MYSQLPP_EXPORT ProtocolOption : public IntegerOption
    00270 {
    00271 #if !defined(DOXYGEN_IGNORE)
    00272 public:
    00273         ProtocolOption(ArgType arg) : IntegerOption(arg) { }
    00274
    00275 private:
    00276         Error set(DBDriver* dbd);
    00277 #endif
    00278 };
    00279 #endif
    00280
    00281
    00283 class MYSQLPP_EXPORT ReadDefaultFileOption : public StringOption
    00284 {
    00285 #if !defined(DOXYGEN_IGNORE)
    00286 public:
    00287         ReadDefaultFileOption(ArgType arg) : StringOption(arg) { }
    00288
    00289 private:
    00290         Error set(DBDriver* dbd);
    00291 #endif
    00292 };
    00293
    00294
    00296 class MYSQLPP_EXPORT ReadDefaultGroupOption : public StringOption
    00297 {
    00298 #if !defined(DOXYGEN_IGNORE)
    00299 public:
    00300         ReadDefaultGroupOption(ArgType arg) : StringOption(arg) { }
    00301
    00302 private:
    00303         Error set(DBDriver* dbd);
    00304 #endif
    00305 };
    00306
    00307
    00309 class MYSQLPP_EXPORT ReadTimeoutOption : public IntegerOption
    00310 {
    00311 #if !defined(DOXYGEN_IGNORE)
    00312 public:
    00313         ReadTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00314
    00315 private:
    00316         Error set(DBDriver* dbd);
    00317 #endif
    00318 };
    00319
    00320
    00322 class MYSQLPP_EXPORT ReconnectOption : public BooleanOption
    00323 {
    00324 #if !defined(DOXYGEN_IGNORE)
    00325 public:
    00326         ReconnectOption(ArgType arg) : BooleanOption(arg) { }
    00327
    00328 private:
    00329         Error set(DBDriver* dbd);
    00330 #endif
    00331 };
    00332
    00333
    00335 class MYSQLPP_EXPORT ReportDataTruncationOption : public BooleanOption
    00336 {
    00337 #if !defined(DOXYGEN_IGNORE)
    00338 public:
    00339         ReportDataTruncationOption(ArgType arg) : BooleanOption(arg) { }
    00340
    00341 private:
    00342         Error set(DBDriver* dbd);
    00343 #endif
    00344 };
    00345
    00346
    00349 class MYSQLPP_EXPORT SecureAuthOption : public BooleanOption
    00350 {
    00351 #if !defined(DOXYGEN_IGNORE)
    00352 public:
    00353         SecureAuthOption(ArgType arg) : BooleanOption(arg) { }
    00354
    00355 private:
    00356         Error set(DBDriver* dbd);
    00357 #endif
    00358 };
    00359
    00360
    00362 class MYSQLPP_EXPORT SetCharsetDirOption : public StringOption
    00363 {
    00364 #if !defined(DOXYGEN_IGNORE)
    00365 public:
    00366         SetCharsetDirOption(ArgType arg) : StringOption(arg) { }
    00367
    00368 private:
    00369         Error set(DBDriver* dbd);
    00370 #endif
    00371 };
    00372
    00373
    00375 class MYSQLPP_EXPORT SetCharsetNameOption : public StringOption
    00376 {
    00377 #if !defined(DOXYGEN_IGNORE)
    00378 public:
    00379         SetCharsetNameOption(ArgType arg) : StringOption(arg) { }
    00380
    00381 private:
    00382         Error set(DBDriver* dbd);
    00383 #endif
    00384 };
    00385
    00386
    00388 class MYSQLPP_EXPORT SetClientIpOption : public StringOption
    00389 {
    00390 #if !defined(DOXYGEN_IGNORE)
    00391 public:
    00392         SetClientIpOption(ArgType arg) : StringOption(arg) { }
    00393
    00394 private:
    00395         Error set(DBDriver* dbd);
    00396 #endif
    00397 };
    00398
    00399
    00401 class MYSQLPP_EXPORT SharedMemoryBaseNameOption : public StringOption
    00402 {
    00403 #if !defined(DOXYGEN_IGNORE)
    00404 public:
    00405         SharedMemoryBaseNameOption(ArgType arg) : StringOption(arg) { }
    00406
    00407 private:
    00408         Error set(DBDriver* dbd);
    00409 #endif
    00410 };
    00411
    00412
    00414 class MYSQLPP_EXPORT SslOption : public Option
    00415 {
    00416 public:
    00429         SslOption(const char* key = 0, const char* cert = 0,
    00430                         const char* ca = 0, const char* capath = 0,
    00431                         const char* cipher = 0)
    00432         {
    00433                 if (key)        key_.assign(key);
    00434                 if (cert)       cert_.assign(key);
    00435                 if (ca)         ca_.assign(key);
    00436                 if (capath)     capath_.assign(key);
    00437                 if (cipher)     cipher_.assign(key);
    00438         }
    00439
    00440 private:
    00441         std::string key_, cert_, ca_, capath_, cipher_;
    00442         Error set(DBDriver* dbd);
    00443 };
    00444
    00445
    00447 class MYSQLPP_EXPORT UseEmbeddedConnectionOption : public Option
    00448 {
    00449 #if !defined(DOXYGEN_IGNORE)
    00450 public:
    00451         UseEmbeddedConnectionOption() : Option() { }
    00452
    00453 private:
    00454         Error set(DBDriver* dbd);
    00455 #endif
    00456 };
    00457
    00458
    00460 class MYSQLPP_EXPORT UseRemoteConnectionOption : public Option
    00461 {
    00462 #if !defined(DOXYGEN_IGNORE)
    00463 public:
    00464         UseRemoteConnectionOption() : Option() { }
    00465
    00466 private:
    00467         Error set(DBDriver* dbd);
    00468 #endif
    00469 };
    00470
    00471
    00473 class MYSQLPP_EXPORT WriteTimeoutOption : public IntegerOption
    00474 {
    00475 #if !defined(DOXYGEN_IGNORE)
    00476 public:
    00477         WriteTimeoutOption(ArgType arg) : IntegerOption(arg) { }
    00478
    00479 private:
    00480         Error set(DBDriver* dbd);
    00481 #endif
    00482 };
    00483
    00484
    00486 // Typedefs
    00487
    00489 typedef std::deque<Option*> OptionList;
    00490
    00492 typedef OptionList::const_iterator OptionListIt;
    00493
    00494 } // end namespace mysqlpp
    00495
    00496 #endif // !defined(MYSQLPP_OPTIONS_H)