The Battle for Wesnoth  1.15.5+dev
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
mariadb::statement Class Reference

Class representing a prepared statement with binding functionality. More...

#include <statement.hpp>

Inheritance diagram for mariadb::statement:
Inheritance graph

Public Member Functions

 statement ()=delete
 
u64 execute ()
 Execute the query and return the number of rows affected. More...
 
u64 insert ()
 Execute the query and return the last insert id. More...
 
result_set_ref query ()
 Execute the query and return a result set. More...
 
void set_connection (connection_ref &connection)
 Set connection ref, used by concurrency. More...
 
 MAKE_SETTER_DECL (blob, stream_ref)
 
 MAKE_SETTER_DECL (date_time, const date_time &)
 
 MAKE_SETTER_DECL (date, const date_time &)
 
 MAKE_SETTER_DECL (time, const time &)
 
 MAKE_SETTER_DECL (data, const data_ref &)
 
 MAKE_SETTER_DECL (decimal, const decimal &)
 
 MAKE_SETTER_DECL (string, const std::string &)
 
 MAKE_SETTER_DECL (boolean, bool)
 
 MAKE_SETTER_DECL (unsigned8, u8)
 
 MAKE_SETTER_DECL (signed8, s8)
 
 MAKE_SETTER_DECL (unsigned16, u16)
 
 MAKE_SETTER_DECL (signed16, s16)
 
 MAKE_SETTER_DECL (unsigned32, u32)
 
 MAKE_SETTER_DECL (signed32, s32)
 
 MAKE_SETTER_DECL (unsigned64, u64)
 
 MAKE_SETTER_DECL (signed64, s64)
 
 MAKE_SETTER_DECL (float, f32)
 
 MAKE_SETTER_DECL (double, f64)
 
void set_null (u32 index)
 
- Public Member Functions inherited from mariadb::last_error
 last_error ()
 
u32 error_no () const
 
const std::string & error () const
 

Private Member Functions

 statement (connection *conn, const std::string &query)
 Private constructor used by connection. More...
 

Private Attributes

connection_ref m_connection
 
connectionm_parent
 
statement_data_ref m_data
 

Friends

class connection
 
class result_set
 
class worker
 

Additional Inherited Members

- Protected Attributes inherited from mariadb::last_error
u32 m_last_error_no
 
std::string m_last_error
 

Detailed Description

Class representing a prepared statement with binding functionality.

Definition at line 39 of file statement.hpp.

Constructor & Destructor Documentation

◆ statement() [1/2]

mariadb::statement::statement ( )
delete

◆ statement() [2/2]

statement::statement ( connection conn,
const std::string &  query 
)
private

Private constructor used by connection.

Definition at line 26 of file statement.cpp.

References i, m_data, mariadb::connection::m_mysql, MYSQL_ERROR, and STMT_ERROR.

Member Function Documentation

◆ execute()

u64 statement::execute ( )

Execute the query and return the number of rows affected.

Returns
Number of rows affected or zero on error

Definition at line 46 of file statement.cpp.

References m_data, and STMT_ERROR.

◆ insert()

u64 statement::insert ( )

Execute the query and return the last insert id.

Returns
Last insert ID or zero on error

Definition at line 55 of file statement.cpp.

References m_data, and STMT_ERROR.

◆ MAKE_SETTER_DECL() [1/18]

mariadb::statement::MAKE_SETTER_DECL ( blob  ,
stream_ref   
)

◆ MAKE_SETTER_DECL() [2/18]

mariadb::statement::MAKE_SETTER_DECL ( date_time  ,
const date_time  
)

◆ MAKE_SETTER_DECL() [3/18]

mariadb::statement::MAKE_SETTER_DECL ( date  ,
const date_time  
)

◆ MAKE_SETTER_DECL() [4/18]

mariadb::statement::MAKE_SETTER_DECL ( time  ,
const time  
)

◆ MAKE_SETTER_DECL() [5/18]

mariadb::statement::MAKE_SETTER_DECL ( data  ,
const data_ref  
)

◆ MAKE_SETTER_DECL() [6/18]

mariadb::statement::MAKE_SETTER_DECL ( decimal  ,
const decimal  
)

◆ MAKE_SETTER_DECL() [7/18]

mariadb::statement::MAKE_SETTER_DECL ( string  ,
const std::string &   
)

◆ MAKE_SETTER_DECL() [8/18]

mariadb::statement::MAKE_SETTER_DECL ( boolean  ,
bool   
)

◆ MAKE_SETTER_DECL() [9/18]

mariadb::statement::MAKE_SETTER_DECL ( unsigned8  ,
u8   
)

◆ MAKE_SETTER_DECL() [10/18]

mariadb::statement::MAKE_SETTER_DECL ( signed8  ,
s8   
)

◆ MAKE_SETTER_DECL() [11/18]

mariadb::statement::MAKE_SETTER_DECL ( unsigned16  ,
u16   
)

◆ MAKE_SETTER_DECL() [12/18]

mariadb::statement::MAKE_SETTER_DECL ( signed16  ,
s16   
)

◆ MAKE_SETTER_DECL() [13/18]

mariadb::statement::MAKE_SETTER_DECL ( unsigned32  ,
u32   
)

◆ MAKE_SETTER_DECL() [14/18]

mariadb::statement::MAKE_SETTER_DECL ( signed32  ,
s32   
)

◆ MAKE_SETTER_DECL() [15/18]

mariadb::statement::MAKE_SETTER_DECL ( unsigned64  ,
u64   
)

◆ MAKE_SETTER_DECL() [16/18]

mariadb::statement::MAKE_SETTER_DECL ( signed64  ,
s64   
)

◆ MAKE_SETTER_DECL() [17/18]

mariadb::statement::MAKE_SETTER_DECL ( float  ,
f32   
)

◆ MAKE_SETTER_DECL() [18/18]

mariadb::statement::MAKE_SETTER_DECL ( double  ,
f64   
)

◆ query()

result_set_ref statement::query ( )

Execute the query and return a result set.

Returns
Result set containing a result or an empty set on error

Definition at line 64 of file statement.cpp.

References mariadb::value::blob, m_data, m_parent, MAKE_SETTER, result_set, and STMT_ERROR_RETURN_RS.

◆ set_connection()

void statement::set_connection ( connection_ref connection)

Set connection ref, used by concurrency.

Definition at line 44 of file statement.cpp.

References connection, and m_connection.

Referenced by mariadb::concurrency::create_statement().

◆ set_null()

void statement::set_null ( u32  index)

Definition at line 173 of file statement.cpp.

References MAKE_SETTER_BODY, and mariadb::bind::set().

Friends And Related Function Documentation

◆ connection

friend class connection
friend

Definition at line 40 of file statement.hpp.

Referenced by set_connection().

◆ result_set

friend class result_set
friend

Definition at line 41 of file statement.hpp.

Referenced by query().

◆ worker

friend class worker
friend

Definition at line 42 of file statement.hpp.

Member Data Documentation

◆ m_connection

connection_ref mariadb::statement::m_connection
private

Definition at line 102 of file statement.hpp.

Referenced by set_connection().

◆ m_data

statement_data_ref mariadb::statement::m_data
private

Definition at line 106 of file statement.hpp.

Referenced by execute(), insert(), query(), and statement().

◆ m_parent

connection* mariadb::statement::m_parent
private

Definition at line 104 of file statement.hpp.

Referenced by query().


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