|
MySQL++
3.2.5
|
A class for building SQL-formatted strings. More...
#include <sqlstream.h>


Public Member Functions | |
| SQLStream (Connection *c, const char *pstr=0) | |
| Create a new stream object attached to a connection. More... | |
| SQLStream (const SQLStream &s) | |
| Create a new stream object as a copy of another. More... | |
| size_t | escape_string (std::string *ps, const char *original=0, size_t length=0) const |
| Return a SQL-escaped version of a character buffer. More... | |
| size_t | escape_string (char *escaped, const char *original, size_t length) const |
| Return a SQL-escaped version of the given character buffer. More... | |
| SQLStream & | operator= (const SQLStream &rhs) |
| Assigns contents of another SQLStream to this one. | |
Public Attributes | |
| Connection * | conn_ |
| Connection to send queries through. | |
A class for building SQL-formatted strings.
See the user manual for more details about these options.
| mysqlpp::SQLStream::SQLStream | ( | Connection * | c, |
| const char * | pstr = 0 |
||
| ) |
Create a new stream object attached to a connection.
| c | connection used for escaping text |
| pstr | an optional initial string |
| mysqlpp::SQLStream::SQLStream | ( | const SQLStream & | s | ) |
Create a new stream object as a copy of another.
This is a traditional copy ctor.
| size_t mysqlpp::SQLStream::escape_string | ( | std::string * | ps, |
| const char * | original = 0, |
||
| size_t | length = 0 |
||
| ) | const |
Return a SQL-escaped version of a character buffer.
| ps | pointer to C++ string to hold escaped version; if original is 0, also holds the original data to be escaped |
| original | if given, pointer to the character buffer to escape instead of contents of *ps |
| length | if both this and original are given, number of characters to escape instead of ps->length() |
| number | of characters placed in *ps |
References conn_, mysqlpp::Connection::driver(), mysqlpp::DBDriver::escape_string(), and mysqlpp::DBDriver::escape_string_no_conn().
| size_t mysqlpp::SQLStream::escape_string | ( | char * | escaped, |
| const char * | original, | ||
| size_t | length | ||
| ) | const |
Return a SQL-escaped version of the given character buffer.
| escaped | character buffer to hold escaped version; must point to at least (length * 2 + 1) bytes |
| original | pointer to the character buffer to escape |
| length | number of characters to escape |
| number | of characters placed in escaped |
DBDriver provides two versions of this method and Query::escape_string() calls the appropriate one based on whether or not a database connection is available. If the connection is available, it can call the DBDriver::escape_string() method. If there is no database connection available (normally only in testing), then DBDriver provides a static version of the function that doesn't use a database connection.
References conn_, mysqlpp::Connection::driver(), mysqlpp::DBDriver::escape_string(), and mysqlpp::DBDriver::escape_string_no_conn().
1.8.15