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 104 of file MariaDBClientASyncAPI.cpp.

105 {
106 return execute_async(new database::mariadb::commands::async::MariaDBCommitCommand(onCommit, onError));
107 }
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 99 of file MariaDBClientASyncAPI.cpp.

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

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 88 of file MariaDBClientASyncAPI.cpp.

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

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 return execute_async(new database::mariadb::commands::async::MariaDBQueryCommand(
70 sql,
71 []() {
72 },
73 onError))
74 .execute_async(new database::mariadb::commands::sync::MariaDBUseResultCommand(
75 [&lastResult = this->lastResult](MYSQL_RES* result) {
76 lastResult = result;
77 },
78 onError))
79 .execute_async(new database::mariadb::commands::async::MariaDBFetchRowCommand(lastResult, onQuery, onError))
80 .execute_async(new database::mariadb::commands::async::MariaDBFreeResultCommand(
82 [this]() {
83 lastResult = nullptr;
84 },
85 onError));
86 }
MariaDBCommandSequence & execute_async(MariaDBCommand *mariaDBCommand) final

References 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 109 of file MariaDBClientASyncAPI.cpp.

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

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 94 of file MariaDBClientASyncAPI.cpp.

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

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: