manip.h
Go to the documentation of this file.
/***********************************************************************
Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
(c) 2004-2007 by Educational Technology Resources, Inc. Others may
also hold copyrights on code in this file. See the CREDITS.txt file
in the top directory of the distribution for details.
This file is part of MySQL++.
MySQL++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
MySQL++ is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with MySQL++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
***********************************************************************/
#ifndef MYSQLPP_MANIP_H
#define MYSQLPP_MANIP_H
#include "common.h"
#include "myset.h"
#include "stadapter.h"
#include <iostream>
namespace mysqlpp {
class SQLQueryParms;
enum quote_type0
{
quote
};
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct quote_type1
{
std::ostream * ostr;
quote_type1(std::ostream * o) :
ostr(o)
{
}
};
inline quote_type1
operator <<(std::ostream& o, quote_type0 /* esc */)
{
return quote_type1(&o);
}
struct quote_type2
{
SQLQueryParms *qparms;
quote_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline quote_type2
operator <<(SQLQueryParms& p, quote_type0 /* esc */)
{
return quote_type2(&p);
}
MYSQLPP_EXPORT SQLQueryParms& operator <<(quote_type2 p,
SQLTypeAdapter& in);
MYSQLPP_EXPORT std::ostream& operator <<(quote_type1 o,
const SQLTypeAdapter& in);
MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& o,
const SQLTypeAdapter& in);
template <class ST>
inline std::ostream&
operator <<(quote_type1 o, const Set<ST>& in)
{
return *o.ostr << '\'' << in << '\'';
}
#endif // !defined(DOXYGEN_IGNORE)
enum quote_only_type0
{
quote_only
};
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct quote_only_type1
{
std::ostream* ostr;
quote_only_type1(std::ostream* o) :
ostr(o)
{
}
};
inline quote_only_type1
operator <<(std::ostream& o, quote_only_type0 /* esc */)
{
return quote_only_type1(&o);
}
struct quote_only_type2
{
SQLQueryParms* qparms;
quote_only_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline quote_only_type2
operator <<(SQLQueryParms& p, quote_only_type0 /* esc */)
{
return quote_only_type2(&p);
}
MYSQLPP_EXPORT SQLQueryParms&
operator <<(quote_only_type2 p, SQLTypeAdapter& in);
MYSQLPP_EXPORT std::ostream&
operator <<(quote_only_type1 o, const SQLTypeAdapter& in);
template <class ST>
inline std::ostream&
operator <<(quote_only_type1 o, const Set<ST>& in)
{
return *o.ostr << '\'' << in << '\'';
}
#endif // !defined(DOXYGEN_IGNORE)
enum quote_double_only_type0
{
quote_double_only
};
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct quote_double_only_type1
{
std::ostream* ostr;
quote_double_only_type1(std::ostream* o) :
ostr(o)
{
}
};
inline quote_double_only_type1
operator <<(std::ostream& o, quote_double_only_type0 /* esc */)
{
return quote_double_only_type1(&o);
}
struct quote_double_only_type2
{
SQLQueryParms *qparms;
quote_double_only_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline quote_double_only_type2
operator <<(SQLQueryParms& p, quote_double_only_type0 /* esc */)
{
return quote_double_only_type2(&p);
}
MYSQLPP_EXPORT SQLQueryParms&
operator <<(quote_double_only_type2 p, SQLTypeAdapter& in);
MYSQLPP_EXPORT std::ostream&
operator <<(quote_double_only_type1 o, const SQLTypeAdapter& in);
template <class ST>
inline std::ostream&
operator <<(quote_double_only_type1 o, const Set<ST>& in)
{
return *o.ostr << '"' << in << '"';
}
#endif // !defined(DOXYGEN_IGNORE)
enum escape_type0 { escape };
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct escape_type1
{
std::ostream* ostr;
escape_type1(std::ostream* o) :
ostr(o)
{
}
};
inline escape_type1
operator <<(std::ostream& o, escape_type0 /* esc */)
{
return escape_type1(&o);
}
struct escape_type2
{
SQLQueryParms *qparms;
escape_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline escape_type2
operator <<(SQLQueryParms& p, escape_type0 /* esc */)
{
return escape_type2(&p);
}
#endif // !defined(DOXYGEN_IGNORE)
MYSQLPP_EXPORT SQLQueryParms&
operator <<(escape_type2 p, SQLTypeAdapter& in);
MYSQLPP_EXPORT std::ostream&
operator <<(escape_type1 o, const SQLTypeAdapter& in);
enum do_nothing_type0
{
do_nothing
};
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct do_nothing_type1
{
std::ostream* ostr;
do_nothing_type1(std::ostream* o) :
ostr(o)
{
}
};
inline do_nothing_type1
operator <<(std::ostream& o, do_nothing_type0 /* esc */)
{
return do_nothing_type1(&o);
}
MYSQLPP_EXPORT std::ostream&
operator <<(do_nothing_type1 o, const SQLTypeAdapter& in);
struct do_nothing_type2
{
SQLQueryParms *qparms;
do_nothing_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline do_nothing_type2
operator <<(SQLQueryParms& p, do_nothing_type0 /* esc */)
{
return do_nothing_type2(&p);
}
MYSQLPP_EXPORT SQLQueryParms&
operator <<(do_nothing_type2 p, SQLTypeAdapter& in);
#endif // !defined(DOXYGEN_IGNORE)
enum ignore_type0
{
ignore
};
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for this section.
struct ignore_type2
{
SQLQueryParms* qparms;
ignore_type2(SQLQueryParms* p) :
qparms(p)
{
}
};
inline ignore_type2
operator <<(SQLQueryParms& p, ignore_type0 /* esc */)
{
return ignore_type2(&p);
}
MYSQLPP_EXPORT SQLQueryParms&
operator <<(ignore_type2 p, SQLTypeAdapter& in);
#endif // !defined(DOXYGEN_IGNORE)
} // end namespace mysqlpp
#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.