# manip.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004
    00005
    00006
    00007
    00008
    00009
    00010
    00011
    00012
    00013
    00014
    00015
    00016
    00017 /***********************************************************************
    00018  Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
    00019  (c) 2004-2007 by Educational Technology Resources, Inc.  Others may
    00020  also hold copyrights on code in this file.  See the CREDITS.txt file
    00021  in the top directory of the distribution for details.
    00022
    00023  This file is part of MySQL++.
    00024
    00025  MySQL++ is free software; you can redistribute it and/or modify it
    00026  under the terms of the GNU Lesser General Public License as published
    00027  by the Free Software Foundation; either version 2.1 of the License, or
    00028  (at your option) any later version.
    00029
    00030  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
    00031  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00032  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
    00033  License for more details.
    00034
    00035  You should have received a copy of the GNU Lesser General Public
    00036  License along with MySQL++; if not, write to the Free Software
    00037  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00038  USA
    00039 ***********************************************************************/
    00040
    00041 #ifndef MYSQLPP_MANIP_H
    00042 #define MYSQLPP_MANIP_H
    00043
    00044 #include "common.h"
    00045
    00046 #include "myset.h"
    00047 #include "stadapter.h"
    00048
    00049 #include <iostream>
    00050
    00051 namespace mysqlpp {
    00052
    00053 class SQLQueryParms;
    00054
    00055
    00069
    00070 enum quote_type0
    00071 {
    00072         quote
    00073 };
    00074
    00075
    00076 #if !defined(DOXYGEN_IGNORE)
    00077 // Doxygen will not generate documentation for this section.
    00078
    00079 struct quote_type1
    00080 {
    00081         std::ostream * ostr;
    00082         quote_type1(std::ostream * o) :
    00083         ostr(o)
    00084         {
    00085         }
    00086 };
    00087
    00088
    00089 inline quote_type1
    00090 operator <<(std::ostream& o, quote_type0 /* esc */)
    00091 {
    00092         return quote_type1(&o);
    00093 }
    00094
    00095
    00096 struct quote_type2
    00097 {
    00098         SQLQueryParms *qparms;
    00099         quote_type2(SQLQueryParms* p) :
    00100         qparms(p)
    00101         {
    00102         }
    00103 };
    00104
    00105
    00106 inline quote_type2
    00107 operator <<(SQLQueryParms& p, quote_type0 /* esc */)
    00108 {
    00109         return quote_type2(&p);
    00110 }
    00111
    00112
    00115
    00116 MYSQLPP_EXPORT SQLQueryParms& operator <<(quote_type2 p,
    00117                 SQLTypeAdapter& in);
    00118
    00119
    00122
    00123 MYSQLPP_EXPORT std::ostream& operator <<(quote_type1 o,
    00124                 const SQLTypeAdapter& in);
    00125
    00126
    00133
    00134 MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& o,
    00135                 const SQLTypeAdapter& in);
    00136
    00137
    00138 template <class ST>
    00139 inline std::ostream&
    00140 operator <<(quote_type1 o, const Set<ST>& in)
    00141 {
    00142         return *o.ostr << '\'' << in << '\'';
    00143 }
    00144
    00145 #endif // !defined(DOXYGEN_IGNORE)
    00146
    00147
    00155
    00156 enum quote_only_type0
    00157 {
    00158         quote_only
    00159 };
    00160
    00161
    00162 #if !defined(DOXYGEN_IGNORE)
    00163 // Doxygen will not generate documentation for this section.
    00164
    00165 struct quote_only_type1
    00166 {
    00167         std::ostream* ostr;
    00168         quote_only_type1(std::ostream* o) :
    00169         ostr(o)
    00170         {
    00171         }
    00172 };
    00173
    00174
    00175 inline quote_only_type1
    00176 operator <<(std::ostream& o, quote_only_type0 /* esc */)
    00177 {
    00178         return quote_only_type1(&o);
    00179 }
    00180
    00181
    00182 struct quote_only_type2
    00183 {
    00184         SQLQueryParms* qparms;
    00185         quote_only_type2(SQLQueryParms* p) :
    00186         qparms(p)
    00187         {
    00188         }
    00189 };
    00190
    00191
    00192 inline quote_only_type2
    00193 operator <<(SQLQueryParms& p, quote_only_type0 /* esc */)
    00194 {
    00195         return quote_only_type2(&p);
    00196 }
    00197
    00198
    00205
    00206 MYSQLPP_EXPORT SQLQueryParms&
    00207 operator <<(quote_only_type2 p, SQLTypeAdapter& in);
    00208
    00209
    00210 MYSQLPP_EXPORT std::ostream&
    00211 operator <<(quote_only_type1 o, const SQLTypeAdapter& in);
    00212
    00213
    00214 template <class ST>
    00215 inline std::ostream&
    00216 operator <<(quote_only_type1 o, const Set<ST>& in)
    00217 {
    00218         return *o.ostr << '\'' << in << '\'';
    00219 }
    00220
    00221 #endif // !defined(DOXYGEN_IGNORE)
    00222
    00223
    00236
    00237 enum quote_double_only_type0
    00238 {
    00239         quote_double_only
    00240 };
    00241
    00242
    00243 #if !defined(DOXYGEN_IGNORE)
    00244 // Doxygen will not generate documentation for this section.
    00245
    00246 struct quote_double_only_type1
    00247 {
    00248         std::ostream* ostr;
    00249         quote_double_only_type1(std::ostream* o) :
    00250         ostr(o)
    00251         {
    00252         }
    00253 };
    00254
    00255
    00256 inline quote_double_only_type1
    00257 operator <<(std::ostream& o, quote_double_only_type0 /* esc */)
    00258 {
    00259         return quote_double_only_type1(&o);
    00260 }
    00261
    00262
    00263 struct quote_double_only_type2
    00264 {
    00265         SQLQueryParms *qparms;
    00266         quote_double_only_type2(SQLQueryParms* p) :
    00267         qparms(p)
    00268         {
    00269         }
    00270 };
    00271
    00272
    00273 inline quote_double_only_type2
    00274 operator <<(SQLQueryParms& p, quote_double_only_type0 /* esc */)
    00275 {
    00276         return quote_double_only_type2(&p);
    00277 }
    00278
    00279
    00286
    00287 MYSQLPP_EXPORT SQLQueryParms&
    00288 operator <<(quote_double_only_type2 p, SQLTypeAdapter& in);
    00289
    00290
    00291 MYSQLPP_EXPORT std::ostream&
    00292 operator <<(quote_double_only_type1 o, const SQLTypeAdapter& in);
    00293
    00294
    00295 template <class ST>
    00296 inline std::ostream&
    00297 operator <<(quote_double_only_type1 o, const Set<ST>& in)
    00298 {
    00299         return *o.ostr << '"' << in << '"';
    00300 }
    00301
    00302 #endif // !defined(DOXYGEN_IGNORE)
    00303
    00304
    00315
    00316 enum escape_type0 { escape };
    00317
    00318
    00319 #if !defined(DOXYGEN_IGNORE)
    00320 // Doxygen will not generate documentation for this section.
    00321
    00322 struct escape_type1
    00323 {
    00324         std::ostream* ostr;
    00325         escape_type1(std::ostream* o) :
    00326         ostr(o)
    00327         {
    00328         }
    00329 };
    00330
    00331
    00332 inline escape_type1
    00333 operator <<(std::ostream& o, escape_type0 /* esc */)
    00334 {
    00335         return escape_type1(&o);
    00336 }
    00337
    00338
    00339 struct escape_type2
    00340 {
    00341         SQLQueryParms *qparms;
    00342         escape_type2(SQLQueryParms* p) :
    00343         qparms(p)
    00344         {
    00345         }
    00346 };
    00347
    00348
    00349 inline escape_type2
    00350 operator <<(SQLQueryParms& p, escape_type0 /* esc */)
    00351 {
    00352         return escape_type2(&p);
    00353 }
    00354
    00355 #endif // !defined(DOXYGEN_IGNORE)
    00356
    00357
    00364
    00365 MYSQLPP_EXPORT SQLQueryParms&
    00366 operator <<(escape_type2 p, SQLTypeAdapter& in);
    00367
    00368
    00371
    00372 MYSQLPP_EXPORT std::ostream&
    00373 operator <<(escape_type1 o, const SQLTypeAdapter& in);
    00374
    00375
    00386
    00387 enum do_nothing_type0
    00388 {
    00389         do_nothing
    00390 };
    00391
    00392
    00393 #if !defined(DOXYGEN_IGNORE)
    00394 // Doxygen will not generate documentation for this section.
    00395
    00396 struct do_nothing_type1
    00397 {
    00398         std::ostream* ostr;
    00399         do_nothing_type1(std::ostream* o) :
    00400         ostr(o)
    00401         {
    00402         }
    00403 };
    00404
    00405
    00406 inline do_nothing_type1
    00407 operator <<(std::ostream& o, do_nothing_type0 /* esc */)
    00408 {
    00409         return do_nothing_type1(&o);
    00410 }
    00411
    00412
    00413 MYSQLPP_EXPORT std::ostream&
    00414 operator <<(do_nothing_type1 o, const SQLTypeAdapter& in);
    00415
    00416
    00417 struct do_nothing_type2
    00418 {
    00419         SQLQueryParms *qparms;
    00420         do_nothing_type2(SQLQueryParms* p) :
    00421         qparms(p)
    00422         {
    00423         }
    00424 };
    00425
    00426
    00427 inline do_nothing_type2
    00428 operator <<(SQLQueryParms& p, do_nothing_type0 /* esc */)
    00429 {
    00430         return do_nothing_type2(&p);
    00431 }
    00432
    00433
    00436
    00437 MYSQLPP_EXPORT SQLQueryParms&
    00438 operator <<(do_nothing_type2 p, SQLTypeAdapter& in);
    00439
    00440 #endif // !defined(DOXYGEN_IGNORE)
    00441
    00442
    00452
    00453 enum ignore_type0
    00454 {
    00455         ignore
    00456 };
    00457
    00458
    00459 #if !defined(DOXYGEN_IGNORE)
    00460 // Doxygen will not generate documentation for this section.
    00461
    00462 struct ignore_type2
    00463 {
    00464         SQLQueryParms* qparms;
    00465         ignore_type2(SQLQueryParms* p) :
    00466         qparms(p)
    00467         {
    00468         }
    00469 };
    00470
    00471
    00472 inline ignore_type2
    00473 operator <<(SQLQueryParms& p, ignore_type0 /* esc */)
    00474 {
    00475         return ignore_type2(&p);
    00476 }
    00477
    00478
    00481
    00482 MYSQLPP_EXPORT SQLQueryParms&
    00483 operator <<(ignore_type2 p, SQLTypeAdapter& in);
    00484
    00485 #endif // !defined(DOXYGEN_IGNORE)
    00486
    00487 } // end namespace mysqlpp
    00488
    00489 #endif