MySQL++: mystring.h File Reference
mystring.h File Reference

Declares String class, MySQL++'s generic std::string-like class, used for holding data received from the database server. More...

`#include "common.h"`
`#include "datetime.h"`
`#include "exceptions.h"`
`#include "null.h"`
`#include "sql_buffer.h"`
`#include <string>`
`#include <sstream>`
`#include <limits>`
`#include <stdlib.h>`
`#include <string.h>`

Go to the source code of this file.

## Classes

class | mysqlpp::String
| A std::string work-alike that can convert itself from SQL text data formats to C++ data types. More...

## Functions

std::ostream & | mysqlpp::operator<< (std::ostream &o, const String &in)
| Stream insertion operator for String objects. More...

## Detailed Description

Declares String class, MySQL++'s generic std::string-like class, used for holding data received from the database server.

## Function Documentation

## operator<<()

MYSQLPP_EXPORT std::ostream & mysqlpp::operator<< | ( | std::ostream & | o,
|  | const String & | in
| ) |  |

Stream insertion operator for String objects.

This doesn't have anything to do with the automatic quoting and escaping you get when using SQLTypeAdapter with Query. The need to use String with Query should be rare, since String generally comes in result sets; it should only go back out as queries when using result data in a new query. Since SQLTypeAdapter has a conversion ctor for String, this shouldn't be a problem. It's just trading simplicity for a tiny bit of inefficiency in a rare case. And since String and SQLTypeAdapter can share a buffer, it's not all that inefficient anyway.