String buffer for composing database queries.
More...
#include <querybuf.h>
|
| Querybuf (size_t reserve=512) |
|
| Querybuf (const Querybuf &)=default |
|
| Querybuf (Querybuf &&)=default |
|
Querybuf & | operator= (const Querybuf &o)=default |
|
Querybuf & | operator= (Querybuf &&o)=default |
|
void | clear () |
| Reset the querybuf to contain the empty string.
|
|
void | start_list (const char *sep) |
| Begin a list of items separated by the given separator. More...
|
|
void | start_list_item () |
| Notify the start of a new list item.
|
|
void | append_int (int val) |
| Append an integer value.
|
|
void | appendf (const char *fmt,...) __attribute__((format(printf |
| Append a formatted string to the querybuf. More...
|
|
void void | append_list (const char *str) |
| Append a string to the querybuf, as part of a list. More...
|
|
void | append_listf (const char *fmt,...) __attribute__((format(printf |
| Append a formatted string to the querybuf, as part of a list. More...
|
|
void void | append_varlist (const std::string &varlist) |
| Append a comma-separated list of integer varcodes parsed from a varlist=B12101,B12013 query parameter.
|
|
void | append_varlist (const std::set< wreport::Varcode > &varlist) |
| Append a comma-separated list of integer varcodes.
|
|
|
bool | list_first |
|
char | list_sep [10] |
|
String buffer for composing database queries.
◆ Querybuf()
dballe::sql::Querybuf::Querybuf |
( |
size_t |
reserve = 512 | ) |
|
|
explicit |
- Parameters
-
reserve | Initial preallocated size for the buffer. If this is chosen wisely, there is no need to reallocate space while composing the query. |
◆ append_list()
void void dballe::sql::Querybuf::append_list |
( |
const char * |
str | ) |
|
Append a string to the querybuf, as part of a list.
This function will prepend str with the current list separator, unless it is the first item added to the list.
- Parameters
-
◆ append_listf()
void dballe::sql::Querybuf::append_listf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Append a formatted string to the querybuf, as part of a list.
This function will prepend str with the current list separator, unless it is the first item added to the list.
- Parameters
-
fmt | printf-style format string. |
◆ appendf()
void dballe::sql::Querybuf::appendf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Append a formatted string to the querybuf.
- Parameters
-
fmt | The string to append, which will be formatted in printf style |
◆ start_list()
void dballe::sql::Querybuf::start_list |
( |
const char * |
sep | ) |
|
Begin a list of items separated by the given separator.
Items are added using append_list().
- Parameters
-
sep | The separator to add between every list item |
The documentation for this struct was generated from the following file: