Database request.
More...
#include <sqld.h>
Database request.
Sqlite data types are more flexible than standard databases, in general the types are automatically detected.
Information on the recent STRICT table option is here.
UTF-16 values are not implemented.
- Examples
- unittest/sqld.cc.
Definition at line 128 of file sqld.h.
◆ clear()
Clear the request and the sql() stream.
After this call, the sql() stream is set empty, and the request is initialized.
Definition at line 146 of file sqld.cc.
◆ col_blob()
void Req::col_blob |
( |
int |
col, |
|
|
std::vector< char > & |
str |
|
) |
| |
Return BLOB unstructured data.
- Parameters
-
Definition at line 405 of file sqld.cc.
◆ col_int()
int Req::col_int |
( |
int |
col | ) |
|
Return 32-bit INTEGER.
- Parameters
-
Definition at line 351 of file sqld.cc.
◆ col_int64()
int64_t Req::col_int64 |
( |
int |
col | ) |
|
Return 64-bit INTEGER.
- Parameters
-
Definition at line 369 of file sqld.cc.
◆ col_name() [1/2]
std::string Req::col_name |
( |
int |
col | ) |
|
Return column name.
- Parameters
-
Definition at line 279 of file sqld.cc.
◆ col_name() [2/2]
void Req::col_name |
( |
int |
col, |
|
|
std::string & |
str |
|
) |
| |
Return column name.
- Parameters
-
Definition at line 297 of file sqld.cc.
◆ col_real()
double Req::col_real |
( |
int |
col | ) |
|
Return 64-bit REAL.
- Parameters
-
Definition at line 387 of file sqld.cc.
◆ col_text() [1/2]
std::string Req::col_text |
( |
int |
col | ) |
|
Return UTF-8 TEXT.
- Parameters
-
Definition at line 315 of file sqld.cc.
◆ col_text() [2/2]
void Req::col_text |
( |
int |
col, |
|
|
std::string & |
str |
|
) |
| |
Return UTF-8 TEXT.
- Parameters
-
Definition at line 333 of file sqld.cc.
◆ exec_select()
Executes in select mode.
Executes statements in sql() stream, until either row data is available, or there are no more statements to process.
If row data is returned, the caller must call next_row() until all rows are retrieved (or clear the request).
- Returns
- Number of columns in the current row, or 0 if no row data.
Definition at line 192 of file sqld.cc.
◆ next_row()
Get the next row.
If there are multiple select-type statements in the sql() stream, exec_select() may need to be called again after next_row() returns 0.
- Returns
- Number of columns in the current row, or 0 if no row data.
Definition at line 252 of file sqld.cc.
◆ reset()
Reset the request without clearing the sql() stream.
After this call, the sql() stream is unchanged, and the request is initialized to start of stream. The sql stream can then be executed again.
Definition at line 155 of file sqld.cc.
◆ sql()
std::ostringstream& scc::sqld::Req::sql |
( |
| ) |
|
|
inline |
Sql streamer.
Adds to the request, for example:
req.sql()
<< "create table t(one int, two int);"
<< "insert into t values(1, 2);"
<< "select * from t;";
Definition at line 230 of file sqld.h.
The documentation for this class was generated from the following files: