#include <row.h>
Inheritance diagram for mysqlpp::Row:
Public Methods | |
Row () | |
Default constructor. | |
Row (MYSQL_ROW d, const ResUse *r, unsigned long *jj, bool te=false) | |
Create a row object. | |
~Row () | |
Destroy object. | |
const Row & | self () const |
Get a const reference to this object. | |
Row & | self () |
Get a reference to this object. | |
const ResUse & | parent () const |
Get a reference to our parent class. | |
size_type | size () const |
Get the number of fields in the row. | |
const ColData | operator[] (size_type i) const |
Get the value of a field given its index. | |
const ColData | lookup_by_name (const char *) const |
Get the value of a field given its field name. | |
const char * | raw_data (int i) const |
Return the value of a field given its index, in raw form. | |
operator bool () const | |
Returns true if there is data in the row. |
|
Create a row object.
|
|
Get the value of a field given its field name. This function is rather inefficient. You should use operator[] if you're using Rows directly, or SSQLS for efficient named access to row elements. |
|
Get the value of a field given its index. If the array index is out of bounds, the C++ standard says that the underlying vector container should throw an exception. Whether it actually does is probably implementation-dependent. Note that we return the ColData object by value. The purpose of ColData is to make it easy to convert the string data returned by the MySQL server to some more appropriate type, so you're almost certain to use this operator in a construct like this:
string s = row[2];
That accesses the third field in the row, returns a temporary ColData object, which is then automatically converted to a
const char* pc = row[2];
This one line of code does what you expect, but |
|
Return the value of a field given its index, in raw form. This is the same thing as operator[], except that the data isn't converted to a ColData object first. Also, this method does not check for out-of-bounds array indices. |