A class which contains a SQL statement parameter. SqlParameter can be useful for keeping SQL queries sanitized and avoid SQL injection. With C++17, it may be desirable to replace this class with std::variant.
More...
#include <SqlStatement.hh>
A class which contains a SQL statement parameter. SqlParameter can be useful for keeping SQL queries sanitized and avoid SQL injection. With C++17, it may be desirable to replace this class with std::variant.
These parameter types map directly to the datatypes of SQLite3: https://www.sqlite.org/datatype3.html
◆ ParamType
An enum to indicate which type of parameter this is.
Enumerator |
---|
NULL_TYPE | |
INTEGER | |
REAL | |
TEXT | |
◆ SqlParameter() [1/7]
◆ SqlParameter() [2/7]
◆ SqlParameter() [3/7]
Construct integer parameter.
- See also
- Set(int64_t)
- Parameters
-
◆ SqlParameter() [4/7]
Construct real parameter.
- See also
- Set(double)
- Parameters
-
◆ SqlParameter() [5/7]
◆ SqlParameter() [6/7]
Copy constructor.
- Parameters
-
◆ SqlParameter() [7/7]
Move constructor.
- Parameters
-
◆ ~SqlParameter()
◆ operator=() [1/2]
Copy assignment operator.
- Parameters
-
- Returns
- This object
◆ operator=() [2/2]
Move assignment operator.
- Parameters
-
- Returns
- This object
◆ QueryInteger()
const int64_t* QueryInteger |
( |
| ) |
const |
Get the integer value of this parameter.
- Returns
- A pointer to this parameter's integer value, or a nullptr if it does not contain an integer.
◆ QueryReal()
const double* QueryReal |
( |
| ) |
const |
Get the floating-point value of this parameter.
- Returns
- A pointer to this parameter's floating-point value, or a nullptr if it does not contain a REAL value.
◆ QueryText()
Get the text value of this paramter.
- Returns
- A pointer to this parameter's text string, or a nullptr if it does not contain a text string.
◆ Set() [1/4]
Set this parameter to a text string.
- Parameters
-
[in] | _text | The value to set this parameter to. |
◆ Set() [2/4]
Set this parameter to a floating-point type.
- Parameters
-
[in] | _real | The value to set this parameter to. |
◆ Set() [3/4]
void Set |
( |
int64_t |
_integer | ) |
|
Set this parameter to an INTEGER type.
- Parameters
-
[in] | _integer | The integer value to set this parameter to. |
◆ Set() [4/4]
Set this parameter to a NULL_TYPE.
- Parameters
-
[in] | _np | Pass in a nullptr. |
◆ Type()
Get the type for this parameter.
- Returns
- The type for this parameter
The documentation for this class was generated from the following file: