sqlstream.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 /***********************************************************************
00005  Copyright (c) 2008 by AboveNet, Inc.  Others may also hold copyrights
00006  on code in this file.  See the CREDITS file in the top directory of
00007  the distribution for details.
00008 
00009  This file is part of MySQL++.
00010 
00011  MySQL++ is free software; you can redistribute it and/or modify it
00012  under the terms of the GNU Lesser General Public License as published
00013  by the Free Software Foundation; either version 2.1 of the License, or
00014  (at your option) any later version.
00015 
00016  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
00017  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019  License for more details.
00020 
00021  You should have received a copy of the GNU Lesser General Public
00022  License along with MySQL++; if not, write to the Free Software
00023  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
00024  USA
00025 ***********************************************************************/
00026 
00027 #if !defined(MYSQLPP_SQLSTREAM_H)
00028 #define MYSQLPP_SQLSTREAM_H
00029 
00030 #include "common.h"
00031 
00032 #include <sstream>
00033 
00034 namespace mysqlpp {
00035 
00036 #if !defined(DOXYGEN_IGNORE)
00037 // Make Doxygen ignore this
00038 class MYSQLPP_EXPORT Connection;
00039 #endif
00040 
00044 
00045 class MYSQLPP_EXPORT SQLStream :
00046 public std::ostringstream
00047 {
00048 public:
00053         SQLStream(Connection* c, const char* pstr = 0);
00054 
00058         SQLStream(const SQLStream& s);
00059 
00074         size_t escape_string(std::string* ps, const char* original = 0,
00075                         size_t length = 0) const;
00076 
00098         size_t escape_string(char* escaped, const char* original,
00099                         size_t length) const;
00100 
00102         SQLStream& operator=(const SQLStream& rhs);
00103 
00105         Connection* conn_;
00106 };
00107 
00108 
00112 inline std::ostream& operator <<(std::ostream& os, SQLStream& s)
00113 {
00114         return os << s.str();
00115 }
00116 
00117 
00118 } // end namespace mysqlpp
00119 
00120 #endif // !defined(MYSQLPP_SQLSTREAM_H)
00121 

Generated on 10 Dec 2013 for MySQL++ by  doxygen 1.4.7