MyBooks
Public Member Functions | Properties | Private Attributes | List of all members
Authors Class Reference

#include <authors.hpp>

Inheritance diagram for Authors:
Inheritance graph
[legend]
Collaboration diagram for Authors:
Collaboration graph
[legend]

Public Member Functions

 Authors (QObject *parent=0)
 
virtual ~Authors ()
 
quint32 getLastErr ()
 
QString getLastErrMsg ()
 
bool depchk (int id)
 
bool save (AuthorsRecord rec)
 
bool del (AuthorsRecord rec)
 
bool update (AuthorsRecord rec)
 
quint32 findLastID ()
 
bool findAuthorsRecord (AuthorsRecord rec)
 
bool findAuthorName (QString strFName, QString strLName)
 
QSqlQuery findAll ()
 
QSqlQuery findID (quint32 id)
 
QSqlQuery findAuthor (QString FName, QString strLName)
 
AuthorsRecord getAuthorsRec (QString strLName)
 

Properties

quint32 err
 
QString errmsg
 

Private Attributes

QSqlDatabase db
 

Constructor & Destructor Documentation

◆ Authors()

Authors::Authors ( QObject *  parent = 0)
explicit

Constructs a database interface to the Authors table. The implementation of the interface to the Authors table in the database provides a wrapper around the SQL functions needed to access and maintain records in the Authors table of the database. Implementation is the same no matter what database server is used.

Database access is provided by public methods:

bool:save(AuthorsRecord rec)
bool:del(AuthorsRecord rec)
bool:update(AuthorsRecord rec)
bool:findAuthorsID(AuthorsRecord rec)
bool:findAuthorName(QString strCall)(int id)
QSqlQuery:findAll()
QSqlQuery:findID(quint32 id)
QSqlQuery:findAuthors(QString callstr)

Parameters
QObject*parent

◆ ~Authors()

Authors::~Authors ( )
virtual

Member Function Documentation

◆ del()

bool Authors::del ( AuthorsRecord  rec)

  bool del(AuthorsRecord rec)

SQL function to delete a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool Success - returns true

◆ depchk()

bool Authors::depchk ( int  id)

SQL function to check if author is used in books table. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - If found as AuthKey in Books table returns true

◆ findAll()

QSqlQuery Authors::findAll ( )

SQL query returning all rows in the table. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findAuthor()

QSqlQuery Authors::findAuthor ( QString  FName,
QString  strLName 
)

SQL query returns SQL query result of rows that match the pattern in callstr. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findAuthorName()

bool Authors::findAuthorName ( QString  strFName,
QString  strLName 
)

SQL function returns true if author is found for a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true if author specific first and last name exists

◆ findAuthorsRecord()

bool Authors::findAuthorsRecord ( AuthorsRecord  rec)

SQL function returns true if author is found for a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

◆ findID()

QSqlQuery Authors::findID ( quint32  id)

SQL query returns SQL query result of one row with id. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of rows with ID - falure returns null

◆ findLastID()

quint32 Authors::findLastID ( )

SQL function returns the highest value of ID for all author records. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
unsigned long - Success returns true

◆ getAuthorsRec()

AuthorsRecord Authors::getAuthorsRec ( QString  strLName)

SQL query returns a AuthorsRecord with data to match the author in strcall. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
AuthorsRecord - Success returns AuthorsRecord result - falure returns empty record

◆ getLastErr()

quint32 Authors::getLastErr ( )
inline

◆ getLastErrMsg()

QString Authors::getLastErrMsg ( )
inline
Here is the call graph for this function:

◆ save()

bool Authors::save ( AuthorsRecord  rec)

SQL function to save author record. This is an interface functiont to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

◆ update()

bool Authors::update ( AuthorsRecord  rec)

SQL function to update a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

Member Data Documentation

◆ db

QSqlDatabase Authors::db
private

Property Documentation

◆ err

quint32 Authors::err
read

This property holds the last error number to be returned.

The number will be returned from the database table handler upon last action.

The default value of this property is QSqlDatabase::NoError (0).

Access functions:

  QString getLastErr()

◆ errmsg

QString Authors::errmsg
read

This property holds the message text to be displayed.

The text will be returned from the database table handler upon last action.

The default value of this property is an empty string.

Access functions:

  QString getLastErrMsg()

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