MySQL++  3.3.0
sqlstream.h
Go to the documentation of this file.
1 
4 /***********************************************************************
5  Copyright (c) 2008 by AboveNet, Inc. Others may also hold copyrights
6  on code in this file. See the CREDITS file in the top directory of
7  the distribution for details.
8 
9  This file is part of MySQL++.
10 
11  MySQL++ is free software; you can redistribute it and/or modify it
12  under the terms of the GNU Lesser General Public License as published
13  by the Free Software Foundation; either version 2.1 of the License, or
14  (at your option) any later version.
15 
16  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19  License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with MySQL++; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24  USA
25 ***********************************************************************/
26 
27 #if !defined(MYSQLPP_SQLSTREAM_H)
28 #define MYSQLPP_SQLSTREAM_H
29 
30 #include "common.h"
31 
32 #include <sstream>
33 
34 namespace mysqlpp {
35 
36 #if !defined(DOXYGEN_IGNORE)
37 // Make Doxygen ignore this
38 class MYSQLPP_EXPORT Connection;
39 #endif
40 
44 
45 class MYSQLPP_EXPORT SQLStream :
46 public std::ostringstream
47 {
48 public:
53  SQLStream(Connection* c, const char* pstr = 0);
54 
58  SQLStream(const SQLStream& s);
59 
74  size_t escape_string(std::string* ps, const char* original = 0,
75  size_t length = 0) const;
76 
98  size_t escape_string(char* escaped, const char* original,
99  size_t length) const;
100 
102  SQLStream& operator=(const SQLStream& rhs);
103 
106 };
107 
108 
112 inline std::ostream& operator <<(std::ostream& os, SQLStream& s)
113 {
114  return os << s.str();
115 }
116 
117 
118 } // end namespace mysqlpp
119 
120 #endif // !defined(MYSQLPP_SQLSTREAM_H)
121 
Manages the connection to the database server.
Definition: connection.h:60
A class for building SQL-formatted strings.
Definition: sqlstream.h:47
Connection * conn_
Connection to send queries through.
Definition: sqlstream.h:105
This file includes top-level definitions for use both internal to the library, and outside it....