SNode.C
Loading...
Searching...
No Matches
database::mariadb::MariaDBClientASyncAPI Class Referenceabstract

#include <MariaDBClientASyncAPI.h>

Inheritance diagram for database::mariadb::MariaDBClientASyncAPI:
Collaboration diagram for database::mariadb::MariaDBClientASyncAPI:

Public Member Functions

MariaDBCommandSequencequery (const std::string &sql, const std::function< void(const MYSQL_ROW)> &onQuery, const std::function< void(const std::string &, unsigned int)> &onError)
MariaDBCommandSequenceexec (const std::string &sql, const std::function< void(void)> &onExec, const std::function< void(const std::string &, unsigned int)> &onError)
MariaDBCommandSequencestartTransactions (const std::function< void(void)> &onAutoCommit, const std::function< void(const std::string &, unsigned int)> &onError)
MariaDBCommandSequenceendTransactions (const std::function< void(void)> &onAutoCommit, const std::function< void(const std::string &, unsigned int)> &onError)
MariaDBCommandSequencecommit (const std::function< void(void)> &onCommit, const std::function< void(const std::string &, unsigned int)> &onError)
MariaDBCommandSequencerollback (const std::function< void(void)> &onRollback, const std::function< void(const std::string &, unsigned int)> &onError)

Protected Member Functions

 MariaDBClientASyncAPI ()=default
 MariaDBClientASyncAPI (const MariaDBClientASyncAPI &)=default
virtual ~MariaDBClientASyncAPI ()
virtual MariaDBCommandSequenceexecute_async (MariaDBCommand *mariaDBCommand)=0

Protected Attributes

MYSQL_RES * lastResult = nullptr

Detailed Description

Definition at line 61 of file MariaDBClientASyncAPI.h.

Constructor & Destructor Documentation

◆ MariaDBClientASyncAPI() [1/2]

database::mariadb::MariaDBClientASyncAPI::MariaDBClientASyncAPI ( )
protecteddefault

◆ MariaDBClientASyncAPI() [2/2]

database::mariadb::MariaDBClientASyncAPI::MariaDBClientASyncAPI ( const MariaDBClientASyncAPI & )
protecteddefault

◆ ~MariaDBClientASyncAPI()

database::mariadb::MariaDBClientASyncAPI::~MariaDBClientASyncAPI ( )
protectedvirtual

Definition at line 63 of file MariaDBClientASyncAPI.cpp.

63 {
64 }

Member Function Documentation

◆ commit()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::commit ( const std::function< void(void)> & onCommit,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 106 of file MariaDBClientASyncAPI.cpp.

107 {
108 return execute_async(new database::mariadb::commands::async::MariaDBCommitCommand(onCommit, onError));
109 }
virtual MariaDBCommandSequence & execute_async(MariaDBCommand *mariaDBCommand)=0

References execute_async().

Here is the call graph for this function:

◆ endTransactions()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::endTransactions ( const std::function< void(void)> & onAutoCommit,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 101 of file MariaDBClientASyncAPI.cpp.

102 {
103 return execute_async(new database::mariadb::commands::async::MariaDBAutoCommitCommand(1, onAutoCommit, onError));
104 }

References execute_async().

Here is the call graph for this function:

◆ exec()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::exec ( const std::string & sql,
const std::function< void(void)> & onExec,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 90 of file MariaDBClientASyncAPI.cpp.

92 {
93 return execute_async(new database::mariadb::commands::async::MariaDBExecCommand(sql, onExec, onError));
94 }

References execute_async().

Referenced by main(), and router().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute_async()

virtual MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::execute_async ( MariaDBCommand * mariaDBCommand)
protectedpure virtual

Implemented in database::mariadb::MariaDBClient, and database::mariadb::MariaDBCommandSequence.

Referenced by commit(), endTransactions(), exec(), query(), rollback(), and startTransactions().

Here is the caller graph for this function:

◆ query()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::query ( const std::string & sql,
const std::function< void(const MYSQL_ROW)> & onQuery,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 66 of file MariaDBClientASyncAPI.cpp.

68 {
69 MariaDBCommandSequence& sequence = execute_async(new database::mariadb::commands::async::MariaDBQueryCommand(
70 sql,
71 []() {
72 },
73 onError));
74
75 return sequence
76 .execute_async(new database::mariadb::commands::sync::MariaDBUseResultCommand(
77 [&lastResult = sequence.lastResult](MYSQL_RES* result) {
78 lastResult = result;
79 },
80 onError))
81 .execute_async(new database::mariadb::commands::async::MariaDBFetchRowCommand(sequence.lastResult, onQuery, onError))
82 .execute_async(new database::mariadb::commands::async::MariaDBFreeResultCommand(
83 sequence.lastResult,
84 [&lastResult = sequence.lastResult]() {
85 lastResult = nullptr;
86 },
87 onError));
88 }
MariaDBCommandSequence & execute_async(MariaDBCommand *mariaDBCommand) final

References execute_async(), and database::mariadb::MariaDBCommandSequence::execute_async().

Referenced by main(), and router().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rollback()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::rollback ( const std::function< void(void)> & onRollback,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 111 of file MariaDBClientASyncAPI.cpp.

112 {
113 return execute_async(new database::mariadb::commands::async::MariaDBRollbackCommand(onRollback, onError));
114 }

References execute_async().

Here is the call graph for this function:

◆ startTransactions()

MariaDBCommandSequence & database::mariadb::MariaDBClientASyncAPI::startTransactions ( const std::function< void(void)> & onAutoCommit,
const std::function< void(const std::string &, unsigned int)> & onError )

Definition at line 96 of file MariaDBClientASyncAPI.cpp.

97 {
98 return execute_async(new database::mariadb::commands::async::MariaDBAutoCommitCommand(0, onAutoCommit, onError));
99 }

References execute_async().

Here is the call graph for this function:

Member Data Documentation

◆ lastResult

MYSQL_RES* database::mariadb::MariaDBClientASyncAPI::lastResult = nullptr
protected

Definition at line 92 of file MariaDBClientASyncAPI.h.


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