MySQL++ Reference Manual

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

manip.h
Go to the documentation of this file.
1
17 /***********************************************************************
18 Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
19 (c) 2004-2007 by Educational Technology Resources, Inc. Others may
20 also hold copyrights on code in this file. See the CREDITS.txt file
21 in the top directory of the distribution for details.
22
23 This file is part of MySQL++.
24
25 MySQL++ is free software; you can redistribute it and/or modify it
26 under the terms of the GNU Lesser General Public License as published
27 by the Free Software Foundation; either version 2.1 of the License, or
28 (at your option) any later version.
29
30 MySQL++ is distributed in the hope that it will be useful, but WITHOUT
31 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
33 License for more details.
34
35 You should have received a copy of the GNU Lesser General Public
36 License along with MySQL++; if not, write to the Free Software
37 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
38 USA
39 ***********************************************************************/
40
41 #ifndef MYSQLPP_MANIP_H
42 #define MYSQLPP_MANIP_H
43
44 #include "common.h"
45
46 #include "myset.h"
47 #include "stadapter.h"
48
49 #include <iostream>
50
51 namespace mysqlpp {
52
53 class SQLQueryParms;
54
55
69
70 enum quote_type0
71 {
72 quote
73 };
74
75
76 #if !defined(DOXYGEN_IGNORE)
77 // Doxygen will not generate documentation for this section.
78
79 struct quote_type1
80 {
81 std::ostream * ostr;
82 quote_type1(std::ostream * o) :
83 ostr(o)
84 {
85 }
86 };
87
88
89 inline quote_type1
90 operator <<(std::ostream& o, quote_type0 /* esc */)
91 {
92 return quote_type1(&o);
93 }
94
95
96 struct quote_type2
97 {
98 SQLQueryParms *qparms;
99 quote_type2(SQLQueryParms* p) :
100 qparms(p)
101 {
102 }
103 };
104
105
106 inline quote_type2
107 operator <<(SQLQueryParms& p, quote_type0 /* esc */)
108 {
109 return quote_type2(&p);
110 }
111
112
115
116 MYSQLPP_EXPORT SQLQueryParms& operator <<(quote_type2 p,
117 SQLTypeAdapter& in);
118
119
122
123 MYSQLPP_EXPORT std::ostream& operator <<(quote_type1 o,
124 const SQLTypeAdapter& in);
125
126
133
134 MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& o,
135 const SQLTypeAdapter& in);
136
137
138 template <class ST>
139 inline std::ostream&
140 operator <<(quote_type1 o, const Set<ST>& in)
141 {
142 return *o.ostr << '\'' << in << '\'';
143 }
144
145 #endif // !defined(DOXYGEN_IGNORE)
146
147
155
156 enum quote_only_type0
157 {
158 quote_only
159 };
160
161
162 #if !defined(DOXYGEN_IGNORE)
163 // Doxygen will not generate documentation for this section.
164
165 struct quote_only_type1
166 {
167 std::ostream* ostr;
168 quote_only_type1(std::ostream* o) :
169 ostr(o)
170 {
171 }
172 };
173
174
175 inline quote_only_type1
176 operator <<(std::ostream& o, quote_only_type0 /* esc */)
177 {
178 return quote_only_type1(&o);
179 }
180
181
182 struct quote_only_type2
183 {
184 SQLQueryParms* qparms;
185 quote_only_type2(SQLQueryParms* p) :
186 qparms(p)
187 {
188 }
189 };
190
191
192 inline quote_only_type2
193 operator <<(SQLQueryParms& p, quote_only_type0 /* esc */)
194 {
195 return quote_only_type2(&p);
196 }
197
198
205
206 MYSQLPP_EXPORT SQLQueryParms&
207 operator <<(quote_only_type2 p, SQLTypeAdapter& in);
208
209
210 MYSQLPP_EXPORT std::ostream&
211 operator <<(quote_only_type1 o, const SQLTypeAdapter& in);
212
213
214 template <class ST>
215 inline std::ostream&
216 operator <<(quote_only_type1 o, const Set<ST>& in)
217 {
218 return *o.ostr << '\'' << in << '\'';
219 }
220
221 #endif // !defined(DOXYGEN_IGNORE)
222
223
236
237 enum quote_double_only_type0
238 {
239 quote_double_only
240 };
241
242
243 #if !defined(DOXYGEN_IGNORE)
244 // Doxygen will not generate documentation for this section.
245
246 struct quote_double_only_type1
247 {
248 std::ostream* ostr;
249 quote_double_only_type1(std::ostream* o) :
250 ostr(o)
251 {
252 }
253 };
254
255
256 inline quote_double_only_type1
257 operator <<(std::ostream& o, quote_double_only_type0 /* esc */)
258 {
259 return quote_double_only_type1(&o);
260 }
261
262
263 struct quote_double_only_type2
264 {
265 SQLQueryParms *qparms;
266 quote_double_only_type2(SQLQueryParms* p) :
267 qparms(p)
268 {
269 }
270 };
271
272
273 inline quote_double_only_type2
274 operator <<(SQLQueryParms& p, quote_double_only_type0 /* esc */)
275 {
276 return quote_double_only_type2(&p);
277 }
278
279
286
287 MYSQLPP_EXPORT SQLQueryParms&
288 operator <<(quote_double_only_type2 p, SQLTypeAdapter& in);
289
290
291 MYSQLPP_EXPORT std::ostream&
292 operator <<(quote_double_only_type1 o, const SQLTypeAdapter& in);
293
294
295 template <class ST>
296 inline std::ostream&
297 operator <<(quote_double_only_type1 o, const Set<ST>& in)
298 {
299 return *o.ostr << '"' << in << '"';
300 }
301
302 #endif // !defined(DOXYGEN_IGNORE)
303
304
315
316 enum escape_type0 { escape };
317
318
319 #if !defined(DOXYGEN_IGNORE)
320 // Doxygen will not generate documentation for this section.
321
322 struct escape_type1
323 {
324 std::ostream* ostr;
325 escape_type1(std::ostream* o) :
326 ostr(o)
327 {
328 }
329 };
330
331
332 inline escape_type1
333 operator <<(std::ostream& o, escape_type0 /* esc */)
334 {
335 return escape_type1(&o);
336 }
337
338
339 struct escape_type2
340 {
341 SQLQueryParms *qparms;
342 escape_type2(SQLQueryParms* p) :
343 qparms(p)
344 {
345 }
346 };
347
348
349 inline escape_type2
350 operator <<(SQLQueryParms& p, escape_type0 /* esc */)
351 {
352 return escape_type2(&p);
353 }
354
355 #endif // !defined(DOXYGEN_IGNORE)
356
357
364
365 MYSQLPP_EXPORT SQLQueryParms&
366 operator <<(escape_type2 p, SQLTypeAdapter& in);
367
368
371
372 MYSQLPP_EXPORT std::ostream&
373 operator <<(escape_type1 o, const SQLTypeAdapter& in);
374
375
386
387 enum do_nothing_type0
388 {
389 do_nothing
390 };
391
392
393 #if !defined(DOXYGEN_IGNORE)
394 // Doxygen will not generate documentation for this section.
395
396 struct do_nothing_type1
397 {
398 std::ostream* ostr;
399 do_nothing_type1(std::ostream* o) :
400 ostr(o)
401 {
402 }
403 };
404
405
406 inline do_nothing_type1
407 operator <<(std::ostream& o, do_nothing_type0 /* esc */)
408 {
409 return do_nothing_type1(&o);
410 }
411
412
413 MYSQLPP_EXPORT std::ostream&
414 operator <<(do_nothing_type1 o, const SQLTypeAdapter& in);
415
416
417 struct do_nothing_type2
418 {
419 SQLQueryParms *qparms;
420 do_nothing_type2(SQLQueryParms* p) :
421 qparms(p)
422 {
423 }
424 };
425
426
427 inline do_nothing_type2
428 operator <<(SQLQueryParms& p, do_nothing_type0 /* esc */)
429 {
430 return do_nothing_type2(&p);
431 }
432
433
436
437 MYSQLPP_EXPORT SQLQueryParms&
438 operator <<(do_nothing_type2 p, SQLTypeAdapter& in);
439
440 #endif // !defined(DOXYGEN_IGNORE)
441
442
452
453 enum ignore_type0
454 {
455 ignore
456 };
457
458
459 #if !defined(DOXYGEN_IGNORE)
460 // Doxygen will not generate documentation for this section.
461
462 struct ignore_type2
463 {
464 SQLQueryParms* qparms;
465 ignore_type2(SQLQueryParms* p) :
466 qparms(p)
467 {
468 }
469 };
470
471
472 inline ignore_type2
473 operator <<(SQLQueryParms& p, ignore_type0 /* esc */)
474 {
475 return ignore_type2(&p);
476 }
477
478
481
482 MYSQLPP_EXPORT SQLQueryParms&
483 operator <<(ignore_type2 p, SQLTypeAdapter& in);
484
485 #endif // !defined(DOXYGEN_IGNORE)
486
487 } // end namespace mysqlpp
488
489 #endif
stadapter.h
Declares the SQLTypeAdapter class.
common.h
This file includes top-level definitions for use both internal to the library, and outside it...
myset.h
Declares templates for generating custom containers used elsewhere in the library.