Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::integrated::query_param Struct Reference

#include <unified_database_system.h>

Collaboration diagram for database::integrated::query_param:
Collaboration graph

Public Member Functions

 query_param (const std::string &v)
 
 query_param (std::string &&v)
 
 query_param (const char *v)
 
 query_param (std::nullptr_t)
 
 query_param (int v)
 
 query_param (long v)
 
 query_param (long long v)
 
 query_param (unsigned int v)
 
 query_param (unsigned long v)
 
 query_param (unsigned long long v)
 
 query_param (double v)
 
 query_param (float v)
 
 query_param (bool v)
 
bool is_null () const noexcept
 Check if this parameter represents a NULL value.
 
const std::string & get_value () const noexcept
 Get the string value (returns empty string for null)
 
std::string to_sql_string () const
 Get the value for SQL generation.
 

Public Attributes

std::optional< std::string > value
 

Detailed Description

Definition at line 199 of file unified_database_system.h.

Constructor & Destructor Documentation

◆ query_param() [1/13]

database::integrated::query_param::query_param ( const std::string & v)
inline

◆ query_param() [2/13]

database::integrated::query_param::query_param ( std::string && v)
inline

Definition at line 204 of file unified_database_system.h.

204: value(std::move(v)) {}

◆ query_param() [3/13]

database::integrated::query_param::query_param ( const char * v)
inline

Definition at line 205 of file unified_database_system.h.

205: value(v ? std::optional<std::string>(v) : std::nullopt) {}

◆ query_param() [4/13]

database::integrated::query_param::query_param ( std::nullptr_t )
inline

Definition at line 206 of file unified_database_system.h.

206: value(std::nullopt) {}

◆ query_param() [5/13]

database::integrated::query_param::query_param ( int v)
inline

Definition at line 207 of file unified_database_system.h.

207: value(std::to_string(v)) {}

◆ query_param() [6/13]

database::integrated::query_param::query_param ( long v)
inline

Definition at line 208 of file unified_database_system.h.

208: value(std::to_string(v)) {}

◆ query_param() [7/13]

database::integrated::query_param::query_param ( long long v)
inline

Definition at line 209 of file unified_database_system.h.

209: value(std::to_string(v)) {}

◆ query_param() [8/13]

database::integrated::query_param::query_param ( unsigned int v)
inline

Definition at line 210 of file unified_database_system.h.

210: value(std::to_string(v)) {}

◆ query_param() [9/13]

database::integrated::query_param::query_param ( unsigned long v)
inline

Definition at line 211 of file unified_database_system.h.

211: value(std::to_string(v)) {}

◆ query_param() [10/13]

database::integrated::query_param::query_param ( unsigned long long v)
inline

Definition at line 212 of file unified_database_system.h.

212: value(std::to_string(v)) {}

◆ query_param() [11/13]

database::integrated::query_param::query_param ( double v)
inline

Definition at line 213 of file unified_database_system.h.

213: value(std::to_string(v)) {}

◆ query_param() [12/13]

database::integrated::query_param::query_param ( float v)
inline

Definition at line 214 of file unified_database_system.h.

214: value(std::to_string(v)) {}

◆ query_param() [13/13]

database::integrated::query_param::query_param ( bool v)
inline

Definition at line 215 of file unified_database_system.h.

215: value(v ? "true" : "false") {}

Member Function Documentation

◆ get_value()

const std::string & database::integrated::query_param::get_value ( ) const
inlinenoexcept

Get the string value (returns empty string for null)

Returns
The parameter value as string, or empty string if null
Note
Use is_null() to distinguish between empty string and null
Examples
/home/runner/work/database_system/database_system/database/integrated/unified_database_system.h.

Definition at line 228 of file unified_database_system.h.

228 {
229 static const std::string empty_string;
230 return value.has_value() ? *value : empty_string;
231 }

References value.

Referenced by test_query_param_null_safety().

Here is the caller graph for this function:

◆ is_null()

bool database::integrated::query_param::is_null ( ) const
inlinenoexcept

Check if this parameter represents a NULL value.

Returns
true if the parameter is null
Examples
/home/runner/work/database_system/database_system/database/integrated/unified_database_system.h.

Definition at line 221 of file unified_database_system.h.

221{ return !value.has_value(); }

References value.

Referenced by test_query_param_null_safety().

Here is the caller graph for this function:

◆ to_sql_string()

std::string database::integrated::query_param::to_sql_string ( ) const
inline

Get the value for SQL generation.

Returns
"NULL" for null values, otherwise the quoted/escaped value
Examples
/home/runner/work/database_system/database_system/database/integrated/unified_database_system.h.

Definition at line 237 of file unified_database_system.h.

237 {
238 return value.has_value() ? *value : "NULL";
239 }

References value.

Referenced by test_query_param_null_safety().

Here is the caller graph for this function:

Member Data Documentation

◆ value

std::optional<std::string> database::integrated::query_param::value

The documentation for this struct was generated from the following file: