Vertica::VString Class Reference
Representation of a String in Vertica. All character data is internally encoded as UTF-8 characters and is not NULL terminated.
Collaboration diagram for Vertica::VString:
| Public Member Functions | |
|---|---|
| VString (const VString &other) | |
| void | alloc (vsize len) |
| Allocate the VString's internal buffer and initialize to 'len' 0 bytes. | |
| int | compare (const VString *other) const |
| Compares this VString to another. | |
| void | copy (const char *s, vsize len) |
| Copy character data from C string to the VString's internal buffer. | |
| void | copy (const char *s) |
| Copy character data from null terminated C string to the VString's internal buffer. | |
| void | copy (const std::string &s) |
| Copy character data from std::string. | |
| void | copy (const VString *from) |
| Copy data from another VString. | |
| void | copy (const VString &from) |
| Copy data from another VString. | |
| const char * | data () const |
| Provides a read-only pointer to this VString's internal data. | |
| char * | data () |
| Provides a writeable pointer to this VString's internal data. | |
| int | equal (const VString *other) const |
| Indicates whether some other VString is equal to this one. | |
| bool | isNull () const |
| Indicates if this VString contains the SQL NULL value. | |
| vsize | length () const |
| Returns the length of this VString. | |
| bool | operator |
| VString & | operator= (const stringtype &s) |
| VString & | operator= (const VString &other) |
| bool | operator== (const VString &other) const |
| bool | operator> (const VString &other) const |
| bool | operator>= (const VString &other) const |
| void | setNull () |
| Sets this VString to the SQL NULL value. | |
| template | |
| stringtype | str () const |
| Provides a copy of this VString's data as a std::string. |
Detailed Description
Representation of a String in Vertica. All character data is internally encoded as UTF-8 characters and is not NULL terminated.
Member Function Documentation
void Vertica::VString::alloc(vsize len)
inline Allocate the VString's internal buffer and initialize to 'len' 0 bytes.
The VString is allocated and set to 'len' zero bytes. It is the caller's responsibility to not provide a value of 'len' that is larger than the maximum size of this VString
Parameters
len: length in bytes
int Vertica::VString::compare(const VString * other) const
inline Compares this VString to another.
Returns -1 if this < other, 0 if equal, 1 if this > other (just like memcmp)
Note SQL NULL compares greater than anything else; two SQL NULLs are considered equal
void Vertica::VString::copy(const char * s, vsize len)
inline Copy character data from C string to the VString's internal buffer.
Data is copied from s into this VString. It is the caller's responsibility to not provide a value of 'len' that is larger than the maximum size of this VString
Parameters
s: character input datalen: length in bytes, not including the terminating null character
Referenced by
void Vertica::VString::copy(const char * s)
inline Copy character data from null terminated C string to the VString's internal buffer.
Parameters
s: null-terminated character input data
Referenced by copy().
void Vertica::VString::copy(const std::string & s)
inline Copy character data from std::string.
Parameters
s: null-terminated character input data
Referenced by copy().
void Vertica::VString::copy(const VString * from)
inline Copy data from another VString.
Parameters
from: The source VString
void Vertica::VString::copy(const VString & from)
inline Copy data from another VString.
Parameters
from: The source VString
Referenced by copy().
const char* Vertica::VString::data() const
inline Provides a read-only pointer to this VString's internal data.
Returns the read only character data for this string, as a pointer.
Note The returned string is not null terminated
Referenced by
char* Vertica::VString::data()
inline Provides a writeable pointer to this VString's internal data.
Returns the writeable character data for this string, as a pointer.
Note The returned string is not null terminated
int Vertica::VString::equal(const VString * other) const
inline Indicates whether some other VString is equal to this one.
Returns -1 if both are SQL NULL, 0 if not equal, 1 if equal so you can easily consider two NULL values to be equal to each other, or not
bool Vertica::VString::isNull() const
inline Indicates if this VString contains the SQL NULL value.
Returns true if this string contains the SQL NULL value, false otherwise
Referenced by
vsize Vertica::VString::length() const
inline Returns the length of this VString.
Returns the length of the string, in bytes. Does not include any extra space for null characters.
Referenced by
template<typename stringtype >
VString& Vertica::VString::operator=(const stringtype & s)
inline Set this object to have the contents of any string object
VString& Vertica::VString::operator=(const VString & other)
inline Copy this object to have the same contents of another VString
template<typename stringtype = std::string>
stringtype Vertica::VString::str() const
inline Provides a copy of this VString's data as a std::string.
Returns a std::string copy of the data in this VString
Referenced by Vertica::operator+().