StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
StormByte::Database::PreparedSTMT Class Referenceabstract

Prepared statement for databases. More...

#include <prepared_stmt.hxx>

Inheritance diagram for StormByte::Database::PreparedSTMT:
Inheritance graph
[legend]

Public Member Functions

 PreparedSTMT (const std::string &name, const std::string &query) noexcept
 
 PreparedSTMT (std::string &&name, std::string &&query) noexcept
 
 PreparedSTMT (const PreparedSTMT &other)=delete
 
 PreparedSTMT (PreparedSTMT &&other)=default
 
virtual ~PreparedSTMT ()=default
 
PreparedSTMToperator= (const PreparedSTMT &other)=delete
 
PreparedSTMToperator= (PreparedSTMT &&other)=default
 
template<typename... Args>
ExpectedRows Execute (Args &&... args)
 
const std::string & Name () const noexcept
 
const std::string & Query () const noexcept
 

Protected Attributes

std::string m_name
 Name of the prepared statement.
 
std::string m_query
 Query to prepare.
 

Detailed Description

Prepared statement for databases.

Constructor & Destructor Documentation

◆ PreparedSTMT() [1/4]

StormByte::Database::PreparedSTMT::PreparedSTMT ( const std::string &  name,
const std::string &  query 
)
inlinenoexcept

Default constructor

Parameters
nameThe name of the prepared statement
queryThe query to prepare

◆ PreparedSTMT() [2/4]

StormByte::Database::PreparedSTMT::PreparedSTMT ( std::string &&  name,
std::string &&  query 
)
inlinenoexcept

Constructor moving string

Parameters
nameThe name of the prepared statement
queryThe query to prepare

◆ PreparedSTMT() [3/4]

StormByte::Database::PreparedSTMT::PreparedSTMT ( const PreparedSTMT other)
delete

Default copy constructor (deleted)

Parameters
otherOther PreparedSTMT to copy from

◆ PreparedSTMT() [4/4]

StormByte::Database::PreparedSTMT::PreparedSTMT ( PreparedSTMT &&  other)
default

Default move constructor

Parameters
otherOther PreparedSTMT to move from

◆ ~PreparedSTMT()

virtual StormByte::Database::PreparedSTMT::~PreparedSTMT ( )
virtualdefault

Member Function Documentation

◆ Execute()

template<typename... Args>
ExpectedRows StormByte::Database::PreparedSTMT::Execute ( Args &&...  args)
inline

Executes the prepared statement with the given arguments

Template Parameters
ArgsTypes of the arguments
Parameters
argsArguments to bind and execute
Returns
Resulting rows

◆ Name()

const std::string & StormByte::Database::PreparedSTMT::Name ( ) const
inlinenoexcept

Gets the name of the prepared statement

Returns
name

◆ operator=() [1/2]

PreparedSTMT & StormByte::Database::PreparedSTMT::operator= ( const PreparedSTMT other)
delete

Default copy assignment operator (deleted)

Parameters
otherOther PreparedSTMT to copy from
Returns
Reference to this PreparedSTMT

◆ operator=() [2/2]

PreparedSTMT & StormByte::Database::PreparedSTMT::operator= ( PreparedSTMT &&  other)
default

Default move assignment operator

Parameters
otherOther PreparedSTMT to move from
Returns
Reference to this PreparedSTMT

◆ Query()

const std::string & StormByte::Database::PreparedSTMT::Query ( ) const
inlinenoexcept

Gets the query of the prepared statement

Returns
query

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