MySQL++ Reference Manual

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

# qparms.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004
    00005
    00006
    00007
    00008 /***********************************************************************
    00009  Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
    00010  MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
    00011  Others may also hold copyrights on code in this file.  See the CREDITS
    00012  file in the top directory of the distribution for details.
    00013
    00014  This file is part of MySQL++.
    00015
    00016  MySQL++ is free software; you can redistribute it and/or modify it
    00017  under the terms of the GNU Lesser General Public License as published
    00018  by the Free Software Foundation; either version 2.1 of the License, or
    00019  (at your option) any later version.
    00020
    00021  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
    00022  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00023  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
    00024  License for more details.
    00025
    00026  You should have received a copy of the GNU Lesser General Public
    00027  License along with MySQL++; if not, write to the Free Software
    00028  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00029  USA
    00030 ***********************************************************************/
    00031
    00032 #ifndef MYSQLPP_QPARMS_H
    00033 #define MYSQLPP_QPARMS_H
    00034
    00035 #include "sql_string.h"
    00036
    00037 #include <vector>
    00038
    00039 namespace mysqlpp {
    00040
    00041 class Query;
    00042
    00043
    00046 class SQLQueryParms : public std::vector<SQLString>
    00047 {
    00048 public:
    00051         typedef const SQLString& ss;
    00052
    00054         SQLQueryParms() :
    00055         parent_(0)
    00056         {
    00057         }
    00058
    00063         SQLQueryParms(Query* p) :
    00064         parent_(p)
    00065         {
    00066         }
    00067
    00071         bool bound()
    00072         {
    00073                 return parent_ != 0;
    00074         }
    00075
    00077         void clear()
    00078         {
    00079                 erase(begin(), end());
    00080         }
    00081
    00083         SQLString& operator [](size_type n)
    00084         {
    00085                 if (n >= size())
    00086                         insert(end(), (n + 1) - size(), "");
    00087                 return std::vector<SQLString>::operator [](n);
    00088         }
    00089
    00091         const SQLString& operator [](size_type n) const
    00092         {
    00093                 return std::vector<SQLString>::operator [](n);
    00094         }
    00095
    00097         MYSQLPP_EXPORT SQLString& operator [](const char *str);
    00098
    00100         MYSQLPP_EXPORT const SQLString& operator [](const char *str) const;
    00101
    00103         SQLQueryParms& operator <<(const SQLString& str)
    00104         {
    00105                 push_back(str);
    00106                 return *this;
    00107         }
    00108
    00110         SQLQueryParms& operator +=(const SQLString& str)
    00111         {
    00112                 push_back(str);
    00113                 return *this;
    00114         }
    00115
    00125         MYSQLPP_EXPORT SQLQueryParms operator +(
    00126                         const SQLQueryParms& other) const;
    00127
    00128 #if !defined(DOXYGEN_IGNORE)
    00129 // Doxygen will not generate documentation for this section.
    00130         void set(ss a)
    00131         {
    00132                 clear();
    00133                 *this << a;
    00134         }
    00135         void set(ss a, ss b)
    00136         {
    00137                 clear();
    00138                 *this << a << b;
    00139         }
    00140         void set(ss a, ss b, ss c)
    00141         {
    00142                 clear();
    00143                 *this << a << b << c;
    00144         }
    00145         void set(ss a, ss b, ss c, ss d)
    00146         {
    00147                 clear();
    00148                 *this << a << b << c << d;
    00149         }
    00150         void set(ss a, ss b, ss c, ss d, ss e)
    00151         {
    00152                 clear();
    00153                 *this << a << b << c << d << e;
    00154         }
    00155         void set(ss a, ss b, ss c, ss d, ss e, ss f)
    00156         {
    00157                 clear();
    00158                 *this << a << b << c << d << e << f;
    00159         }
    00160         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g)
    00161         {
    00162                 clear();
    00163                 *this << a << b << c << d << e << f << g;
    00164         }
    00165         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h)
    00166         {
    00167                 clear();
    00168                 *this << a << b << c << d << e << f << g << h;
    00169         }
    00170         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h, ss i)
    00171         {
    00172                 clear();
    00173                 *this << a << b << c << d << e << f << g << h << i;
    00174         }
    00175         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h, ss i, ss j)
    00176         {
    00177                 clear();
    00178                 *this << a << b << c << d << e << f << g << h << i << j;
    00179         }
    00180         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g, ss h, ss i, ss j, ss k)
    00181         {
    00182                 clear();
    00183                 *this << a << b << c << d << e << f << g << h << i << j << k;
    00184         }
    00185 #endif // !defined(DOXYGEN_IGNORE)
    00186
    00192         void set(ss a, ss b, ss c, ss d, ss e, ss f, ss g,
    00193                         ss h, ss i, ss j, ss k, ss l)
    00194         {
    00195                 clear();
    00196                 *this << a << b << c << d << e << f << g << h << i << j << k << l;
    00197         }
    00198
    00199 private:
    00200         friend class Query;
    00201
    00202         Query* parent_;
    00203 };
    00204
    00205
    00227
    00228 struct SQLParseElement
    00229 {
    00235         SQLParseElement(std::string b, char o, char n) :
    00236         before(b),
    00237         option(o),
    00238         num(n)
    00239         {
    00240         }
    00241
    00242         std::string before;
    00243         char option;
    00244         char num;
    00245 };
    00246
    00247 } // end namespace mysqlpp
    00248
    00249 #endif // !defined(MYSQLPP_QPARMS_H)
    00250