C++ SDK Documentation  12.0.0
Vertica::ClientMessage Class Reference

Holds the contents of a user-defined message to be reported by a UDx. More...

Collaboration diagram for Vertica::ClientMessage:
Collaboration graph

Public Member Functions

 ClientMessage (int errorcode, std::string main, std::string hint="", std::string detail="")
 
 ClientMessage ()
 
bool hasDetail () const
 
bool hasHint () const
 
template<typename... Argtypes>
ClientMessagesetDetail (const char *fmt, Argtypes &&...args)
 
template<typename... Argtypes>
ClientMessagesetHint (const char *fmt, Argtypes &&...args)
 
void truncateLengths (size_t maxLen)
 

Static Public Member Functions

template<typename... Argtypes>
static ClientMessage makeMessage (int errorcode, const char *fmt, Argtypes &&...args)
 

Public Attributes

std::string msg_detail
 
int msg_errorcode
 
std::string msg_hint
 
std::string msg_main
 

Detailed Description

Holds the contents of a user-defined message to be reported by a UDx.

Made using ClientMessage::makeMessage(...). Must have an error code and main message, but the hint and detail strings are optional. Reported to the client using one of the ServerInterface methods (reportInfo, reportNotice, reportWarning, or reportError).

Constructor & Destructor Documentation

Vertica::ClientMessage::ClientMessage ( int  errorcode,
std::string  main,
std::string  hint = "",
std::string  detail = "" 
)
inline

Constructor

Vertica::ClientMessage::ClientMessage ( )
inline

Nullary constructor

Referenced by makeMessage().

Member Function Documentation

bool Vertica::ClientMessage::hasDetail ( ) const
inline

Does this message have a non-empty detail?

Returns
true if this message has a detail field set
bool Vertica::ClientMessage::hasHint ( ) const
inline

Does this message have a non-empty hint?

Returns
true if this message has a hint field set
template<typename... Argtypes>
static ClientMessage Vertica::ClientMessage::makeMessage ( int  errorcode,
const char *  fmt,
Argtypes &&...  args 
)
inlinestatic

Builds a message using printf-style arguments to format the main text.

Parameters
errorcodeThis message's id number
fmtA printf-style format string for the main body
argsAny arguments to be substituted into fmt
Returns
a ClientMessage with the provided error code & formatted main body
template<typename... Argtypes>
ClientMessage& Vertica::ClientMessage::setDetail ( const char *  fmt,
Argtypes &&...  args 
)
inline

Sets this message's detail field.

Parameters
fmtA printf-style format string for the detail
argsAny argumetns to be substituted into fmt
Returns
a reference to this message, to allow for chaining
template<typename... Argtypes>
ClientMessage& Vertica::ClientMessage::setHint ( const char *  fmt,
Argtypes &&...  args 
)
inline

Sets this message's hint field.

Parameters
fmtA printf-style format string for the hint
argsAny argumetns to be substituted into fmt
Returns
a reference to this message, to allow for chaining
void Vertica::ClientMessage::truncateLengths ( size_t  maxLen)
inline

Truncate the lengths of the string fields, keeping them at most maxLen

Parameters
maxLenThe largest length allowed for this message's fields

Member Data Documentation

std::string Vertica::ClientMessage::msg_detail

Message detail (optional)

Referenced by hasDetail(), setDetail(), and truncateLengths().

int Vertica::ClientMessage::msg_errorcode

ID code for this message

std::string Vertica::ClientMessage::msg_hint

Message hint (optional)

Referenced by hasHint(), setHint(), and truncateLengths().

std::string Vertica::ClientMessage::msg_main

Main message body (required)

Referenced by truncateLengths().