Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

manip.h

Go to the documentation of this file.
00001 #ifndef MYSQLPP_MANIP_H
00002 #define MYSQLPP_MANIP_H
00003 
00020 
00021 #include "defs.h"
00022 
00023 #include "datetime.h"
00024 #include "myset.h"
00025 #include "sql_string.h"
00026 #include "sql_query.h"
00027 
00028 #include <mysql.h>
00029 
00030 #include <iostream>
00031 
00035 namespace mysqlpp {
00036         extern bool dont_quote_auto;
00037 
00046 
00047 enum quote_type0 {
00048         quote   
00049 };
00050 
00051 class SQLQueryParms;
00052 
00054 // Doxygen will not generate documentation for this section.
00055 
00056 struct quote_type1
00057 {
00058   std::ostream *ostr;
00059   quote_type1(std::ostream *o) : ostr(o) {}
00060 }; 
00061 
00062 inline quote_type1 operator << (std::ostream &o, quote_type0 /*esc*/)
00063 {
00064   return quote_type1(&o);
00065 }
00066 
00067 struct quote_type2
00068 {
00069   SQLQueryParms *qparms;
00070   quote_type2(SQLQueryParms *p) : qparms(p) {}
00071 };
00072 
00073 inline quote_type2 operator << (SQLQueryParms &p, quote_type0 /*esc*/)
00074 {
00075   return quote_type2(&p);
00076 }
00077 
00078 SQLQueryParms& operator << (quote_type2 p, SQLString &in);
00079 
00080 template <class T>
00081 inline std::ostream& operator << (quote_type1 o, const T &in)
00082 {
00083   return *o.ostr << in;
00084 }
00085 
00086 std::ostream&
00087 operator << (std::ostream& o,const ColData_Tmpl<std::string>& in);
00088 
00089 std::ostream&
00090 operator << (std::ostream& o, const ColData_Tmpl<const_string>& in);
00091 
00092 SQLQuery& operator << (SQLQuery& o, const ColData_Tmpl<std::string>& in);
00093 
00094 SQLQuery& operator << (SQLQuery& o, const ColData_Tmpl<const_string>& in);
00095 
00096 template <>
00097 std::ostream& operator << (quote_type1 o, const std::string &in);
00098 
00099 template <>
00100 std::ostream& operator << (quote_type1 o, const char* const &in);
00101 
00102 template <>
00103 std::ostream& operator << (quote_type1 o, const ColData_Tmpl<std::string>& in);
00104 
00105 template <>
00106 std::ostream& operator << (quote_type1 o, const ColData_Tmpl<const_string>& in);
00107 
00108 template <>
00109 inline std::ostream& operator << (quote_type1 o, char* const &in) {
00110   return operator << (o, const_cast<const char* const &>(in));
00111 }
00112 
00113 template <>
00114 inline std::ostream& operator << (quote_type1 o, const Date &in) {
00115   return *o.ostr << "'" << in << "'";
00116 }
00117 
00118 template <>
00119 inline std::ostream& operator << (quote_type1 o, const Time &in) {
00120   return *o.ostr << "'" << in << "'";
00121 }
00122 
00123 template <>
00124 inline std::ostream& operator << (quote_type1 o, const DateTime &in) {
00125   return *o.ostr << "'" << in << "'";
00126 }
00127 
00128 template <class ST>
00129 inline std::ostream& operator << (quote_type1 o, const Set<ST> &in) {
00130   return *o.ostr << "'" << in << "'";
00131 }
00132 
00134 
00135 
00143 
00144 enum quote_only_type0 {
00145         quote_only      
00146 };
00147 
00149 // Doxygen will not generate documentation for this section.
00150 
00151 struct quote_only_type1 {
00152   std::ostream *ostr;
00153   quote_only_type1(std::ostream *o) : ostr(o) {}
00154 }; 
00155 
00156 inline quote_only_type1 operator << (std::ostream &o, quote_only_type0 /*esc*/) {
00157   return quote_only_type1(&o);
00158 }
00159 
00160 struct quote_only_type2 {
00161   SQLQueryParms *qparms;
00162   quote_only_type2(SQLQueryParms *p) : qparms(p) {}
00163 };
00164 
00165 inline quote_only_type2 operator << (SQLQueryParms &p, quote_only_type0 /*esc*/) {
00166   return quote_only_type2(&p);
00167 }
00168 
00169 SQLQueryParms & operator << (quote_only_type2 p, SQLString &in);
00170 
00171 template <class T>
00172 inline std::ostream& operator << (quote_only_type1 o, const T &in) {
00173   return *o.ostr << in;
00174 }
00175 
00176 template <>
00177 inline std::ostream& operator << (quote_only_type1 o, const std::string &in) {
00178   return *o.ostr << "'" << in << "'";
00179 }
00180 
00181 template <>
00182 std::ostream& operator << (quote_only_type1 o, const ColData_Tmpl<std::string>& in);
00183 
00184 template <>
00185 std::ostream& operator << (quote_only_type1 o, const ColData_Tmpl<const_string>& in);
00186 
00187 template <>
00188 inline std::ostream& operator << (quote_only_type1 o, const Date &in) {
00189   return *o.ostr << "'" << in << "'";
00190 }
00191 
00192 template <>
00193 inline std::ostream& operator << (quote_only_type1 o, const Time &in) {
00194   return *o.ostr << "'" << in << "'";
00195 }
00196 
00197 template <>
00198 inline std::ostream& operator << (quote_only_type1 o, const DateTime &in) {
00199   return *o.ostr << "'" << in << "'";
00200 }
00201 
00202 template <class ST>
00203 inline std::ostream& operator << (quote_only_type1 o, const Set<ST> &in) {
00204   return *o.ostr << "'" << in << "'";
00205 }
00206 
00208 
00209 
00217 
00218 enum quote_double_only_type0 {
00219         quote_double_only       
00220 };
00221 
00223 // Doxygen will not generate documentation for this section.
00224 
00225 struct quote_double_only_type1 {
00226   std::ostream *ostr;
00227   quote_double_only_type1(std::ostream *o) : ostr(o) {}
00228 }; 
00229 
00230 inline quote_double_only_type1 operator << (std::ostream &o,
00231                                             quote_double_only_type0 /*esc*/) {
00232   return quote_double_only_type1(&o);
00233 }
00234 
00235 struct quote_double_only_type2 {
00236   SQLQueryParms *qparms;
00237   quote_double_only_type2(SQLQueryParms *p) : qparms(p) {}
00238 };
00239 
00240 inline quote_double_only_type2 operator << (SQLQueryParms &p, 
00241                                              quote_double_only_type0 /*esc*/) {
00242   return quote_double_only_type2(&p);
00243 }
00244 
00245 SQLQueryParms & operator << (quote_double_only_type2 p, SQLString &in);
00246 
00247 template <class T>
00248 inline std::ostream& operator << (quote_double_only_type1 o, const T &in) {
00249   return *o.ostr << in;
00250 }
00251 
00252 template <>
00253 inline std::ostream& operator << (quote_double_only_type1 o, const std::string &in) {
00254   return *o.ostr << "\"" << in << "\"";
00255 }
00256 
00257 template <>
00258 std::ostream& operator << (quote_double_only_type1 o, const ColData_Tmpl<std::string>& in);
00259 
00260 template <>
00261 std::ostream& operator << (quote_double_only_type1 o, const ColData_Tmpl<const_string>& in);
00262 
00263 template <>
00264 inline std::ostream& operator << (quote_double_only_type1 o, const Date &in) {
00265   return *o.ostr << "\"" << in << "\"";
00266 }
00267 
00268 template <>
00269 inline std::ostream& operator << (quote_double_only_type1 o, const Time &in) {
00270   return *o.ostr << "\"" << in << "\"";
00271 }
00272 
00273 template <>
00274 inline std::ostream& operator << (quote_double_only_type1 o,
00275                              const DateTime &in) {
00276   return *o.ostr << "\"" << in << "\"";
00277 }
00278 
00279 template <class ST>
00280 inline std::ostream& operator << (quote_double_only_type1 o,
00281                              const Set<ST> &in) {
00282   return *o.ostr << "\"" << in << "\"";
00283 }
00284 
00286 
00287 
00294 
00295 enum escape_type0 { escape };
00296 
00298 struct escape_type1 {
00299   std::ostream *ostr;
00300   escape_type1(std::ostream *o) : ostr(o) {}
00301 }; 
00302 
00303 inline escape_type1 operator << (std::ostream &o, escape_type0 /*esc*/) {
00304   return escape_type1(&o);
00305 }
00306 
00308 struct escape_type2 {
00309   SQLQueryParms *qparms;
00310   escape_type2(SQLQueryParms *p) : qparms(p) {}
00311 };
00312 
00313 inline escape_type2 operator << (SQLQueryParms &p, escape_type0 /*esc*/) {
00314   return escape_type2(&p);
00315 }
00316 
00317 SQLQueryParms & operator << (escape_type2 p, SQLString &in);
00318 
00319 template <class T>
00320 inline std::ostream& operator << (escape_type1 o, const T &in) {
00321   return *o.ostr << in;
00322 }
00323 
00324 template <>
00325 std::ostream& operator << (escape_type1 o, const std::string &in);
00326 
00327 template <>
00328 std::ostream& operator << (escape_type1 o, const char* const &in);
00329 
00330 template <>
00331 std::ostream& operator << (escape_type1 o, const ColData_Tmpl<std::string>& in);
00332 
00333 template <>
00334 std::ostream& operator << (escape_type1 o, const ColData_Tmpl<const_string>& in);
00335 
00336 template <>
00337 inline std::ostream& operator << (escape_type1 o, char* const &in) {
00338   return operator << (o, const_cast<const char* const &>(in));
00339 }
00340 
00341 
00352 
00353 enum do_nothing_type0 {
00354         do_nothing 
00355 };
00356 
00358 // Doxygen will not generate documentation for this section.
00359 
00360 struct do_nothing_type1 {
00361   std::ostream *ostr;
00362   do_nothing_type1(std::ostream *o) : ostr(o) {}
00363 }; 
00364 
00365 inline do_nothing_type1 operator << (std::ostream &o, do_nothing_type0 /*esc*/) {
00366   return do_nothing_type1(&o);
00367 }
00368 
00369 template <class T>
00370 inline std::ostream& operator << (do_nothing_type1 o, const T &in) {
00371   return *o.ostr << in;
00372 }
00373 
00374 struct do_nothing_type2 {
00375   SQLQueryParms *qparms;
00376   do_nothing_type2(SQLQueryParms *p) : qparms(p) {}
00377 };
00378 
00379 inline do_nothing_type2 operator << (SQLQueryParms &p, do_nothing_type0 /*esc*/) {
00380   return do_nothing_type2(&p);
00381 }
00382 
00383 inline SQLQueryParms & operator << (do_nothing_type2 p, SQLString &in) {
00384   in.processed = true;
00385   return *p.qparms << in;
00386 }
00387 
00389 
00390 
00391 
00401 
00402 enum ignore_type0 {
00403         ignore 
00404 };
00405 
00407 struct ignore_type2 {
00408   SQLQueryParms *qparms;
00409   ignore_type2(SQLQueryParms *p) : qparms(p) {}
00410 };
00411 
00412 inline ignore_type2 operator << (SQLQueryParms &p, ignore_type0 /*esc*/) {
00413   return ignore_type2(&p);
00414 }
00415 
00416 inline SQLQueryParms & operator << (ignore_type2 p, SQLString &in) {
00417   return *p.qparms << in;
00418 }
00419 
00420 } // end namespace mysqlpp
00421 
00422 #endif
00423 

Generated on Thu May 5 05:30:43 2005 for MySQL++ by doxygen1.2.18