Banking_System_Server  1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
DB::DbResult Class Reference

The DbResult class represents a result set returned from a database query. More...

#include <dbresult.h>

Collaboration diagram for DB::DbResult:
Collaboration graph

Public Member Functions

 DbResult ()
 Default constructor for DbResult. More...
 
 DbResult (const QList< QVariant > &data)
 Constructs a DbResult from a list of QVariant data. More...
 
bool isEmpty () const
 Checks if the result set is empty. More...
 
QJsonObject first () const
 Retrieves the first item in the result set. More...
 
int size () const
 Gets the number of items in the result set. More...
 
QJsonObject data (int pos) const
 Retrieves data at a specific position in the result set. More...
 
QJsonArray data () const
 Gets all the data in the result set. More...
 
QString toJsonString () const
 Converts the result set to a JSON string. More...
 

Detailed Description

The DbResult class represents a result set returned from a database query.

This class encapsulates the data returned from a database operation and provides methods to access and manipulate the result. It stores the result in a JSON array format.

Constructor & Destructor Documentation

◆ DbResult() [1/2]

DbResult::DbResult ( )

Default constructor for DbResult.

Initializes an empty DbResult object.

◆ DbResult() [2/2]

DbResult::DbResult ( const QList< QVariant > &  data)

Constructs a DbResult from a list of QVariant data.

Parameters
dataA QList<QVariant> containing data to be stored in the result. The data is converted into a JSON array of QJsonObjects.
Here is the call graph for this function:

Member Function Documentation

◆ data() [1/2]

QJsonArray DbResult::data ( ) const

Gets all the data in the result set.

Returns
A QJsonArray containing all the items in the result set.

Referenced by DbResult(), and first().

Here is the caller graph for this function:

◆ data() [2/2]

QJsonObject DbResult::data ( int  pos) const

Retrieves data at a specific position in the result set.

Parameters
posThe index position of the item to retrieve.
Returns
A QJsonObject representing the data at the specified position. Returns an empty QJsonObject if the position is out of bounds or if the result set is empty.

Referenced by GetDatabaseRequest::execute(), and GetTransactionsHistoryRequest::execute().

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

◆ first()

QJsonObject DbResult::first ( ) const

Retrieves the first item in the result set.

Returns
A QJsonObject representing the first item. If the result set is empty, returns an empty QJsonObject.

Referenced by CreateNewUserRequest::execute(), DeleteUserRequest::execute(), GetAccountNumberRequest::execute(), GetBalanceRequest::execute(), GetDatabaseRequest::execute(), GetTransactionsHistoryRequest::execute(), LoginRequest::execute(), MakeTransactionRequest::execute(), UpdateEmailRequest::execute(), UpdatePasswordRequest::execute(), UpdateUserRequest::execute(), and UserInitRequest::execute().

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

◆ isEmpty()

◆ size()

int DbResult::size ( ) const

Gets the number of items in the result set.

Returns
The number of items in the result set.

Referenced by data(), GetDatabaseRequest::execute(), and GetTransactionsHistoryRequest::execute().

Here is the caller graph for this function:

◆ toJsonString()

QString DbResult::toJsonString ( ) const

Converts the result set to a JSON string.

Returns
A QString containing the JSON representation of the result set.

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