#include <sql_buffer.h>
Collaboration diagram for mysqlpp::SQLBuffer:

Public Types | |
| typedef unsigned int | size_type |
| Type of length values. | |
Public Member Functions | |
| SQLBuffer (const char *data, size_type length, mysql_type_info type, bool is_null) | |
| Initialize object as a copy of a raw data buffer. | |
| SQLBuffer (const std::string &s, mysql_type_info type, bool is_null) | |
| Initialize object as a copy of a C++ string object. | |
| ~SQLBuffer () | |
| Destructor. | |
| SQLBuffer & | assign (const char *data, size_type length, mysql_type_info type=mysql_type_info::string_type, bool is_null=false) |
| Replace contents of buffer with copy of given C string. | |
| SQLBuffer & | assign (const std::string &s, mysql_type_info type=mysql_type_info::string_type, bool is_null=false) |
| Replace contents of buffer with copy of given C++ string. | |
| const char * | data () const |
| Return pointer to raw data buffer. | |
| bool | escape_q () const |
| Returns true if we were initialized with a data type that must be escaped when used in a SQL query. | |
| size_type | length () const |
| Return number of bytes in data buffer. | |
| bool | is_string () |
| Returns true if type of buffer's contents is string. | |
| bool | is_null () const |
| Return true if buffer's contents represent a SQL null. | |
| bool | quote_q () const |
| Returns true if we were initialized with a data type that must be quoted when used in a SQL query. | |
| void | set_null () |
| Sets the internal SQL null flag. | |
| const mysql_type_info & | type () const |
| Return the SQL type of the data held in the buffer. | |
| mysqlpp::SQLBuffer::SQLBuffer | ( | const char * | data, | |
| size_type | length, | |||
| mysql_type_info | type, | |||
| bool | is_null | |||
| ) | [inline] |
Initialize object as a copy of a raw data buffer.
Copies the string into a new buffer one byte longer than the length value given, using that to hold a C string null terminator, just for safety. The length value we keep does not include this extra byte, allowing this same mechanism to work for both C strings and binary data.
| bool mysqlpp::SQLBuffer::is_null | ( | ) | const [inline] |
Return true if buffer's contents represent a SQL null.
The buffer's actual content will probably be "NULL" or something like it, but in the SQL data type system, a SQL null is distinct from a plain string with value "NULL".
| size_type mysqlpp::SQLBuffer::length | ( | ) | const [inline] |
Return number of bytes in data buffer.
Count does not include the trailing null we tack on to our copy of the buffer for ease of use in C string contexts. We do this because we can be holding binary data just as easily as a C string.
1.4.7